diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/Azure.ResourceManager.Attestation.sln b/sdk/attestation/Azure.ResourceManager.Attestation/Azure.ResourceManager.Attestation.sln index 258d4a0fda0d..585033e5a530 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/Azure.ResourceManager.Attestation.sln +++ b/sdk/attestation/Azure.ResourceManager.Attestation/Azure.ResourceManager.Attestation.sln @@ -41,6 +41,7 @@ Global {EE13F5AD-B732-484A-9F03-76B67FFB5015}.Release|x64.Build.0 = Release|Any CPU {EE13F5AD-B732-484A-9F03-76B67FFB5015}.Release|x86.ActiveCfg = Release|Any CPU {EE13F5AD-B732-484A-9F03-76B67FFB5015}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.net10.0.cs b/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.net10.0.cs index 991bb0535b7e..bf8e24f72141 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.net10.0.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.net10.0.cs @@ -9,10 +9,10 @@ public static partial class AttestationExtensions public static Azure.ResourceManager.Attestation.AttestationProviderCollection GetAttestationProviders(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetAttestationProviders(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetAttestationProvidersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Pageable GetAttestationProvidersByDefaultProvider(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.AsyncPageable GetAttestationProvidersByDefaultProviderAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Response GetDefaultByLocationAttestationProvider(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> GetDefaultByLocationAttestationProviderAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetDefaultAttestationProvider(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDefaultAttestationProviderAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetDefaultAttestationProviderByLocation(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDefaultAttestationProviderByLocationAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class AttestationPrivateEndpointConnectionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -34,10 +34,13 @@ protected AttestationPrivateEndpointConnectionCollection() { } public partial class AttestationPrivateEndpointConnectionData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AttestationPrivateEndpointConnectionData() { } - public Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState ConnectionState { get { throw null; } set { } } - public string PrivateEndpointStringId { get { throw null; } } + public Azure.Core.ResourceIdentifier PrivateEndpointId { get { throw null; } } + public Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get { throw null; } set { } } public Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState? ProvisioningState { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -85,10 +88,14 @@ public partial class AttestationProviderData : Azure.ResourceManager.Models.Trac public AttestationProviderData(Azure.Core.AzureLocation location) { } public System.Uri AttestUri { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } - public Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } public Azure.ResourceManager.Attestation.Models.AttestationServiceStatus? Status { get { throw null; } set { } } + public Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType? TpmAttestationAuthentication { get { throw null; } set { } } public string TrustModel { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.AttestationProviderData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.AttestationProviderData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -111,8 +118,8 @@ protected AttestationProviderResource() { } public virtual Azure.Response GetAttestationPrivateEndpointConnection(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAttestationPrivateEndpointConnectionAsync(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionCollection GetAttestationPrivateEndpointConnections() { throw null; } - public virtual Azure.Pageable GetPrivateLinkResourcesByProvider(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetPrivateLinkResourcesByProviderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPrivateLinkResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPrivateLinkResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -152,21 +159,53 @@ public partial class MockableAttestationSubscriptionResource : Azure.ResourceMan protected MockableAttestationSubscriptionResource() { } public virtual Azure.Pageable GetAttestationProviders(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAttestationProvidersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetAttestationProvidersByDefaultProvider(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetAttestationProvidersByDefaultProviderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetDefaultByLocationAttestationProvider(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetDefaultByLocationAttestationProviderAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDefaultAttestationProvider(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDefaultAttestationProviderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDefaultAttestationProviderByLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDefaultAttestationProviderByLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.Attestation.Models { public static partial class ArmAttestationModelFactory { - public static Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionData AttestationPrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string privateEndpointStringId = null, Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState connectionState = null, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState? provisioningState = default(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState?)) { throw null; } - public static Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResource AttestationPrivateLinkResource(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } + public static Azure.ResourceManager.Attestation.Models.AttestationJsonWebKey AttestationJsonWebKey(string alg = null, string crv = null, string d = null, string dp = null, string dq = null, string e = null, string k = null, string kid = null, string kty = null, string n = null, string p = null, string q = null, string qi = null, string use = null, string x = null, System.Collections.Generic.IEnumerable x5C = null, string y = null) { throw null; } + public static Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionData AttestationPrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState? provisioningState = default(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState?), Azure.Core.ResourceIdentifier privateEndpointId = null) { throw null; } + public static Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResource AttestationPrivateLinkResource(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties AttestationPrivateLinkResourceProperties(string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } public static Azure.ResourceManager.Attestation.Models.AttestationProviderCreateOrUpdateContent AttestationProviderCreateOrUpdateContent(Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams properties = null) { throw null; } - public static Azure.ResourceManager.Attestation.AttestationProviderData AttestationProviderData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string trustModel = null, Azure.ResourceManager.Attestation.Models.AttestationServiceStatus? status = default(Azure.ResourceManager.Attestation.Models.AttestationServiceStatus?), System.Uri attestUri = null, Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? publicNetworkAccess = default(Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType?), System.Collections.Generic.IEnumerable privateEndpointConnections = null) { throw null; } - public static Azure.ResourceManager.Attestation.Models.JsonWebKey JsonWebKey(string alg = null, string crv = null, string d = null, string dp = null, string dq = null, string e = null, string k = null, string kid = null, string kty = null, string n = null, string p = null, string q = null, string qi = null, string use = null, string x = null, System.Collections.Generic.IEnumerable x5C = null, string y = null) { throw null; } + public static Azure.ResourceManager.Attestation.AttestationProviderData AttestationProviderData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string trustModel = null, Azure.ResourceManager.Attestation.Models.AttestationServiceStatus? status = default(Azure.ResourceManager.Attestation.Models.AttestationServiceStatus?), System.Uri attestUri = null, Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType? publicNetworkAccess = default(Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType?), System.Collections.Generic.IEnumerable privateEndpointConnections = null, Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType? tpmAttestationAuthentication = default(Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType?)) { throw null; } + public static Azure.ResourceManager.Attestation.Models.AttestationProviderPatch AttestationProviderPatch(System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties properties = null) { throw null; } + } + public partial class AttestationJsonWebKey : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AttestationJsonWebKey(string kty) { } + public string Alg { get { throw null; } set { } } + public string Crv { get { throw null; } set { } } + public string D { get { throw null; } set { } } + public string Dp { get { throw null; } set { } } + public string Dq { get { throw null; } set { } } + public string E { get { throw null; } set { } } + public string K { get { throw null; } set { } } + public string Kid { get { throw null; } set { } } + public string Kty { get { throw null; } } + public string N { get { throw null; } set { } } + public string P { get { throw null; } set { } } + public string Q { get { throw null; } set { } } + public string Qi { get { throw null; } set { } } + public string Use { get { throw null; } set { } } + public string X { get { throw null; } set { } } + public System.Collections.Generic.IList X5C { get { throw null; } } + public string Y { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationJsonWebKey JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationJsonWebKey PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Attestation.Models.AttestationJsonWebKey System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Attestation.Models.AttestationJsonWebKey System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct AttestationPrivateEndpointConnectionProvisioningState : System.IEquatable @@ -183,6 +222,7 @@ public static partial class ArmAttestationModelFactory public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState left, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState right) { throw null; } public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState left, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState right) { throw null; } public override string ToString() { throw null; } } @@ -200,29 +240,50 @@ public static partial class ArmAttestationModelFactory public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus left, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus right) { throw null; } public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus left, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus right) { throw null; } public override string ToString() { throw null; } } public partial class AttestationPrivateLinkResource : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public AttestationPrivateLinkResource() { } - public string GroupId { get { throw null; } } - public System.Collections.Generic.IReadOnlyList RequiredMembers { get { throw null; } } - public System.Collections.Generic.IList RequiredZoneNames { get { throw null; } } + internal AttestationPrivateLinkResource() { } + public Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties Properties { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResource System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResource System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class AttestationPrivateLinkResourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AttestationPrivateLinkResourceProperties() { } + public string GroupId { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RequiredMembers { get { throw null; } } + public System.Collections.Generic.IList RequiredZoneNames { get { throw null; } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class AttestationPrivateLinkServiceConnectionState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AttestationPrivateLinkServiceConnectionState() { } public string ActionsRequired { get { throw null; } set { } } public string Description { get { throw null; } set { } } public Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus? Status { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -235,7 +296,10 @@ public AttestationProviderCreateOrUpdateContent(Azure.Core.AzureLocation locatio public Azure.Core.AzureLocation Location { get { throw null; } } public Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams Properties { get { throw null; } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderCreateOrUpdateContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderCreateOrUpdateContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.Models.AttestationProviderCreateOrUpdateContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationProviderCreateOrUpdateContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -245,21 +309,60 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class AttestationProviderPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AttestationProviderPatch() { } - public Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? AttestationServicePatchSpecificParamsPublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties Properties { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderPatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderPatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.Models.AttestationProviderPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationProviderPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class AttestationProviderPatchProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AttestationProviderPatchProperties() { } + public Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType? TpmAttestationAuthentication { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AttestationPublicNetworkAccessType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AttestationPublicNetworkAccessType(string value) { throw null; } + public static Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType Disabled { get { throw null; } } + public static Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType left, Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType right) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType left, Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType right) { throw null; } + public override string ToString() { throw null; } + } public partial class AttestationServiceCreationSpecificParams : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AttestationServiceCreationSpecificParams() { } - public System.Collections.Generic.IList PolicySigningCertificatesKeys { get { throw null; } } - public Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } + public System.Collections.Generic.IList PolicySigningCertificatesKeys { get { throw null; } } + public Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType? TpmAttestationAuthentication { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -280,50 +383,25 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Attestation.Models.AttestationServiceStatus left, Azure.ResourceManager.Attestation.Models.AttestationServiceStatus right) { throw null; } public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationServiceStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationServiceStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Attestation.Models.AttestationServiceStatus left, Azure.ResourceManager.Attestation.Models.AttestationServiceStatus right) { throw null; } public override string ToString() { throw null; } } - public partial class JsonWebKey : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public JsonWebKey(string kty) { } - public string Alg { get { throw null; } set { } } - public string Crv { get { throw null; } set { } } - public string D { get { throw null; } set { } } - public string Dp { get { throw null; } set { } } - public string Dq { get { throw null; } set { } } - public string E { get { throw null; } set { } } - public string K { get { throw null; } set { } } - public string Kid { get { throw null; } set { } } - public string Kty { get { throw null; } } - public string N { get { throw null; } set { } } - public string P { get { throw null; } set { } } - public string Q { get { throw null; } set { } } - public string Qi { get { throw null; } set { } } - public string Use { get { throw null; } set { } } - public string X { get { throw null; } set { } } - public System.Collections.Generic.IList X5C { get { throw null; } } - public string Y { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.Attestation.Models.JsonWebKey System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.Attestation.Models.JsonWebKey System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct PublicNetworkAccessType : System.IEquatable + public readonly partial struct TpmAttestationAuthenticationType : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; - public PublicNetworkAccessType(string value) { throw null; } - public static Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType Disabled { get { throw null; } } - public static Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType Enabled { get { throw null; } } - public bool Equals(Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType other) { throw null; } + public TpmAttestationAuthenticationType(string value) { throw null; } + public static Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType Disabled { get { throw null; } } + public static Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType other) { throw null; } public override bool Equals(object obj) { throw null; } public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType left, Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType right) { throw null; } - public static implicit operator Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType left, Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType right) { throw null; } + public static bool operator ==(Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType left, Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType right) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType left, Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType right) { throw null; } public override string ToString() { throw null; } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.net8.0.cs b/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.net8.0.cs index 991bb0535b7e..bf8e24f72141 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.net8.0.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.net8.0.cs @@ -9,10 +9,10 @@ public static partial class AttestationExtensions public static Azure.ResourceManager.Attestation.AttestationProviderCollection GetAttestationProviders(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetAttestationProviders(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetAttestationProvidersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Pageable GetAttestationProvidersByDefaultProvider(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.AsyncPageable GetAttestationProvidersByDefaultProviderAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Response GetDefaultByLocationAttestationProvider(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> GetDefaultByLocationAttestationProviderAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetDefaultAttestationProvider(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDefaultAttestationProviderAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetDefaultAttestationProviderByLocation(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDefaultAttestationProviderByLocationAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class AttestationPrivateEndpointConnectionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -34,10 +34,13 @@ protected AttestationPrivateEndpointConnectionCollection() { } public partial class AttestationPrivateEndpointConnectionData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AttestationPrivateEndpointConnectionData() { } - public Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState ConnectionState { get { throw null; } set { } } - public string PrivateEndpointStringId { get { throw null; } } + public Azure.Core.ResourceIdentifier PrivateEndpointId { get { throw null; } } + public Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get { throw null; } set { } } public Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState? ProvisioningState { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -85,10 +88,14 @@ public partial class AttestationProviderData : Azure.ResourceManager.Models.Trac public AttestationProviderData(Azure.Core.AzureLocation location) { } public System.Uri AttestUri { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } - public Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } public Azure.ResourceManager.Attestation.Models.AttestationServiceStatus? Status { get { throw null; } set { } } + public Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType? TpmAttestationAuthentication { get { throw null; } set { } } public string TrustModel { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.AttestationProviderData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.AttestationProviderData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -111,8 +118,8 @@ protected AttestationProviderResource() { } public virtual Azure.Response GetAttestationPrivateEndpointConnection(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAttestationPrivateEndpointConnectionAsync(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionCollection GetAttestationPrivateEndpointConnections() { throw null; } - public virtual Azure.Pageable GetPrivateLinkResourcesByProvider(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetPrivateLinkResourcesByProviderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPrivateLinkResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPrivateLinkResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -152,21 +159,53 @@ public partial class MockableAttestationSubscriptionResource : Azure.ResourceMan protected MockableAttestationSubscriptionResource() { } public virtual Azure.Pageable GetAttestationProviders(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAttestationProvidersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetAttestationProvidersByDefaultProvider(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetAttestationProvidersByDefaultProviderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetDefaultByLocationAttestationProvider(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetDefaultByLocationAttestationProviderAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDefaultAttestationProvider(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDefaultAttestationProviderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDefaultAttestationProviderByLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDefaultAttestationProviderByLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.Attestation.Models { public static partial class ArmAttestationModelFactory { - public static Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionData AttestationPrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string privateEndpointStringId = null, Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState connectionState = null, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState? provisioningState = default(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState?)) { throw null; } - public static Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResource AttestationPrivateLinkResource(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } + public static Azure.ResourceManager.Attestation.Models.AttestationJsonWebKey AttestationJsonWebKey(string alg = null, string crv = null, string d = null, string dp = null, string dq = null, string e = null, string k = null, string kid = null, string kty = null, string n = null, string p = null, string q = null, string qi = null, string use = null, string x = null, System.Collections.Generic.IEnumerable x5C = null, string y = null) { throw null; } + public static Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionData AttestationPrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState? provisioningState = default(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState?), Azure.Core.ResourceIdentifier privateEndpointId = null) { throw null; } + public static Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResource AttestationPrivateLinkResource(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties AttestationPrivateLinkResourceProperties(string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } public static Azure.ResourceManager.Attestation.Models.AttestationProviderCreateOrUpdateContent AttestationProviderCreateOrUpdateContent(Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams properties = null) { throw null; } - public static Azure.ResourceManager.Attestation.AttestationProviderData AttestationProviderData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string trustModel = null, Azure.ResourceManager.Attestation.Models.AttestationServiceStatus? status = default(Azure.ResourceManager.Attestation.Models.AttestationServiceStatus?), System.Uri attestUri = null, Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? publicNetworkAccess = default(Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType?), System.Collections.Generic.IEnumerable privateEndpointConnections = null) { throw null; } - public static Azure.ResourceManager.Attestation.Models.JsonWebKey JsonWebKey(string alg = null, string crv = null, string d = null, string dp = null, string dq = null, string e = null, string k = null, string kid = null, string kty = null, string n = null, string p = null, string q = null, string qi = null, string use = null, string x = null, System.Collections.Generic.IEnumerable x5C = null, string y = null) { throw null; } + public static Azure.ResourceManager.Attestation.AttestationProviderData AttestationProviderData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string trustModel = null, Azure.ResourceManager.Attestation.Models.AttestationServiceStatus? status = default(Azure.ResourceManager.Attestation.Models.AttestationServiceStatus?), System.Uri attestUri = null, Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType? publicNetworkAccess = default(Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType?), System.Collections.Generic.IEnumerable privateEndpointConnections = null, Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType? tpmAttestationAuthentication = default(Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType?)) { throw null; } + public static Azure.ResourceManager.Attestation.Models.AttestationProviderPatch AttestationProviderPatch(System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties properties = null) { throw null; } + } + public partial class AttestationJsonWebKey : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AttestationJsonWebKey(string kty) { } + public string Alg { get { throw null; } set { } } + public string Crv { get { throw null; } set { } } + public string D { get { throw null; } set { } } + public string Dp { get { throw null; } set { } } + public string Dq { get { throw null; } set { } } + public string E { get { throw null; } set { } } + public string K { get { throw null; } set { } } + public string Kid { get { throw null; } set { } } + public string Kty { get { throw null; } } + public string N { get { throw null; } set { } } + public string P { get { throw null; } set { } } + public string Q { get { throw null; } set { } } + public string Qi { get { throw null; } set { } } + public string Use { get { throw null; } set { } } + public string X { get { throw null; } set { } } + public System.Collections.Generic.IList X5C { get { throw null; } } + public string Y { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationJsonWebKey JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationJsonWebKey PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Attestation.Models.AttestationJsonWebKey System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Attestation.Models.AttestationJsonWebKey System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct AttestationPrivateEndpointConnectionProvisioningState : System.IEquatable @@ -183,6 +222,7 @@ public static partial class ArmAttestationModelFactory public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState left, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState right) { throw null; } public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState left, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState right) { throw null; } public override string ToString() { throw null; } } @@ -200,29 +240,50 @@ public static partial class ArmAttestationModelFactory public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus left, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus right) { throw null; } public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus left, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus right) { throw null; } public override string ToString() { throw null; } } public partial class AttestationPrivateLinkResource : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public AttestationPrivateLinkResource() { } - public string GroupId { get { throw null; } } - public System.Collections.Generic.IReadOnlyList RequiredMembers { get { throw null; } } - public System.Collections.Generic.IList RequiredZoneNames { get { throw null; } } + internal AttestationPrivateLinkResource() { } + public Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties Properties { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResource System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResource System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class AttestationPrivateLinkResourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AttestationPrivateLinkResourceProperties() { } + public string GroupId { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RequiredMembers { get { throw null; } } + public System.Collections.Generic.IList RequiredZoneNames { get { throw null; } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class AttestationPrivateLinkServiceConnectionState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AttestationPrivateLinkServiceConnectionState() { } public string ActionsRequired { get { throw null; } set { } } public string Description { get { throw null; } set { } } public Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus? Status { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -235,7 +296,10 @@ public AttestationProviderCreateOrUpdateContent(Azure.Core.AzureLocation locatio public Azure.Core.AzureLocation Location { get { throw null; } } public Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams Properties { get { throw null; } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderCreateOrUpdateContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderCreateOrUpdateContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.Models.AttestationProviderCreateOrUpdateContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationProviderCreateOrUpdateContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -245,21 +309,60 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class AttestationProviderPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AttestationProviderPatch() { } - public Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? AttestationServicePatchSpecificParamsPublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties Properties { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderPatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderPatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.Models.AttestationProviderPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationProviderPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class AttestationProviderPatchProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AttestationProviderPatchProperties() { } + public Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType? TpmAttestationAuthentication { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AttestationPublicNetworkAccessType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AttestationPublicNetworkAccessType(string value) { throw null; } + public static Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType Disabled { get { throw null; } } + public static Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType left, Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType right) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType left, Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType right) { throw null; } + public override string ToString() { throw null; } + } public partial class AttestationServiceCreationSpecificParams : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AttestationServiceCreationSpecificParams() { } - public System.Collections.Generic.IList PolicySigningCertificatesKeys { get { throw null; } } - public Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } + public System.Collections.Generic.IList PolicySigningCertificatesKeys { get { throw null; } } + public Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType? TpmAttestationAuthentication { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -280,50 +383,25 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Attestation.Models.AttestationServiceStatus left, Azure.ResourceManager.Attestation.Models.AttestationServiceStatus right) { throw null; } public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationServiceStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationServiceStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Attestation.Models.AttestationServiceStatus left, Azure.ResourceManager.Attestation.Models.AttestationServiceStatus right) { throw null; } public override string ToString() { throw null; } } - public partial class JsonWebKey : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public JsonWebKey(string kty) { } - public string Alg { get { throw null; } set { } } - public string Crv { get { throw null; } set { } } - public string D { get { throw null; } set { } } - public string Dp { get { throw null; } set { } } - public string Dq { get { throw null; } set { } } - public string E { get { throw null; } set { } } - public string K { get { throw null; } set { } } - public string Kid { get { throw null; } set { } } - public string Kty { get { throw null; } } - public string N { get { throw null; } set { } } - public string P { get { throw null; } set { } } - public string Q { get { throw null; } set { } } - public string Qi { get { throw null; } set { } } - public string Use { get { throw null; } set { } } - public string X { get { throw null; } set { } } - public System.Collections.Generic.IList X5C { get { throw null; } } - public string Y { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.Attestation.Models.JsonWebKey System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.Attestation.Models.JsonWebKey System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct PublicNetworkAccessType : System.IEquatable + public readonly partial struct TpmAttestationAuthenticationType : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; - public PublicNetworkAccessType(string value) { throw null; } - public static Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType Disabled { get { throw null; } } - public static Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType Enabled { get { throw null; } } - public bool Equals(Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType other) { throw null; } + public TpmAttestationAuthenticationType(string value) { throw null; } + public static Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType Disabled { get { throw null; } } + public static Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType other) { throw null; } public override bool Equals(object obj) { throw null; } public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType left, Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType right) { throw null; } - public static implicit operator Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType left, Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType right) { throw null; } + public static bool operator ==(Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType left, Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType right) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType left, Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType right) { throw null; } public override string ToString() { throw null; } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.netstandard2.0.cs b/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.netstandard2.0.cs index 991bb0535b7e..bf8e24f72141 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.netstandard2.0.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.netstandard2.0.cs @@ -9,10 +9,10 @@ public static partial class AttestationExtensions public static Azure.ResourceManager.Attestation.AttestationProviderCollection GetAttestationProviders(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetAttestationProviders(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetAttestationProvidersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Pageable GetAttestationProvidersByDefaultProvider(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.AsyncPageable GetAttestationProvidersByDefaultProviderAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Response GetDefaultByLocationAttestationProvider(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> GetDefaultByLocationAttestationProviderAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetDefaultAttestationProvider(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDefaultAttestationProviderAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetDefaultAttestationProviderByLocation(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDefaultAttestationProviderByLocationAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class AttestationPrivateEndpointConnectionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -34,10 +34,13 @@ protected AttestationPrivateEndpointConnectionCollection() { } public partial class AttestationPrivateEndpointConnectionData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AttestationPrivateEndpointConnectionData() { } - public Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState ConnectionState { get { throw null; } set { } } - public string PrivateEndpointStringId { get { throw null; } } + public Azure.Core.ResourceIdentifier PrivateEndpointId { get { throw null; } } + public Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get { throw null; } set { } } public Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState? ProvisioningState { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -85,10 +88,14 @@ public partial class AttestationProviderData : Azure.ResourceManager.Models.Trac public AttestationProviderData(Azure.Core.AzureLocation location) { } public System.Uri AttestUri { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } - public Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } public Azure.ResourceManager.Attestation.Models.AttestationServiceStatus? Status { get { throw null; } set { } } + public Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType? TpmAttestationAuthentication { get { throw null; } set { } } public string TrustModel { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.AttestationProviderData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.AttestationProviderData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -111,8 +118,8 @@ protected AttestationProviderResource() { } public virtual Azure.Response GetAttestationPrivateEndpointConnection(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAttestationPrivateEndpointConnectionAsync(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionCollection GetAttestationPrivateEndpointConnections() { throw null; } - public virtual Azure.Pageable GetPrivateLinkResourcesByProvider(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetPrivateLinkResourcesByProviderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPrivateLinkResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPrivateLinkResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -152,21 +159,53 @@ public partial class MockableAttestationSubscriptionResource : Azure.ResourceMan protected MockableAttestationSubscriptionResource() { } public virtual Azure.Pageable GetAttestationProviders(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAttestationProvidersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetAttestationProvidersByDefaultProvider(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetAttestationProvidersByDefaultProviderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetDefaultByLocationAttestationProvider(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetDefaultByLocationAttestationProviderAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDefaultAttestationProvider(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDefaultAttestationProviderAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDefaultAttestationProviderByLocation(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDefaultAttestationProviderByLocationAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.Attestation.Models { public static partial class ArmAttestationModelFactory { - public static Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionData AttestationPrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string privateEndpointStringId = null, Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState connectionState = null, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState? provisioningState = default(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState?)) { throw null; } - public static Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResource AttestationPrivateLinkResource(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } + public static Azure.ResourceManager.Attestation.Models.AttestationJsonWebKey AttestationJsonWebKey(string alg = null, string crv = null, string d = null, string dp = null, string dq = null, string e = null, string k = null, string kid = null, string kty = null, string n = null, string p = null, string q = null, string qi = null, string use = null, string x = null, System.Collections.Generic.IEnumerable x5C = null, string y = null) { throw null; } + public static Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionData AttestationPrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState? provisioningState = default(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState?), Azure.Core.ResourceIdentifier privateEndpointId = null) { throw null; } + public static Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResource AttestationPrivateLinkResource(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties AttestationPrivateLinkResourceProperties(string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } public static Azure.ResourceManager.Attestation.Models.AttestationProviderCreateOrUpdateContent AttestationProviderCreateOrUpdateContent(Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams properties = null) { throw null; } - public static Azure.ResourceManager.Attestation.AttestationProviderData AttestationProviderData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string trustModel = null, Azure.ResourceManager.Attestation.Models.AttestationServiceStatus? status = default(Azure.ResourceManager.Attestation.Models.AttestationServiceStatus?), System.Uri attestUri = null, Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? publicNetworkAccess = default(Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType?), System.Collections.Generic.IEnumerable privateEndpointConnections = null) { throw null; } - public static Azure.ResourceManager.Attestation.Models.JsonWebKey JsonWebKey(string alg = null, string crv = null, string d = null, string dp = null, string dq = null, string e = null, string k = null, string kid = null, string kty = null, string n = null, string p = null, string q = null, string qi = null, string use = null, string x = null, System.Collections.Generic.IEnumerable x5C = null, string y = null) { throw null; } + public static Azure.ResourceManager.Attestation.AttestationProviderData AttestationProviderData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string trustModel = null, Azure.ResourceManager.Attestation.Models.AttestationServiceStatus? status = default(Azure.ResourceManager.Attestation.Models.AttestationServiceStatus?), System.Uri attestUri = null, Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType? publicNetworkAccess = default(Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType?), System.Collections.Generic.IEnumerable privateEndpointConnections = null, Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType? tpmAttestationAuthentication = default(Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType?)) { throw null; } + public static Azure.ResourceManager.Attestation.Models.AttestationProviderPatch AttestationProviderPatch(System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties properties = null) { throw null; } + } + public partial class AttestationJsonWebKey : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AttestationJsonWebKey(string kty) { } + public string Alg { get { throw null; } set { } } + public string Crv { get { throw null; } set { } } + public string D { get { throw null; } set { } } + public string Dp { get { throw null; } set { } } + public string Dq { get { throw null; } set { } } + public string E { get { throw null; } set { } } + public string K { get { throw null; } set { } } + public string Kid { get { throw null; } set { } } + public string Kty { get { throw null; } } + public string N { get { throw null; } set { } } + public string P { get { throw null; } set { } } + public string Q { get { throw null; } set { } } + public string Qi { get { throw null; } set { } } + public string Use { get { throw null; } set { } } + public string X { get { throw null; } set { } } + public System.Collections.Generic.IList X5C { get { throw null; } } + public string Y { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationJsonWebKey JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationJsonWebKey PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Attestation.Models.AttestationJsonWebKey System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Attestation.Models.AttestationJsonWebKey System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct AttestationPrivateEndpointConnectionProvisioningState : System.IEquatable @@ -183,6 +222,7 @@ public static partial class ArmAttestationModelFactory public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState left, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState right) { throw null; } public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState left, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState right) { throw null; } public override string ToString() { throw null; } } @@ -200,29 +240,50 @@ public static partial class ArmAttestationModelFactory public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus left, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus right) { throw null; } public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus left, Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus right) { throw null; } public override string ToString() { throw null; } } public partial class AttestationPrivateLinkResource : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public AttestationPrivateLinkResource() { } - public string GroupId { get { throw null; } } - public System.Collections.Generic.IReadOnlyList RequiredMembers { get { throw null; } } - public System.Collections.Generic.IList RequiredZoneNames { get { throw null; } } + internal AttestationPrivateLinkResource() { } + public Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties Properties { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResource System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResource System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class AttestationPrivateLinkResourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AttestationPrivateLinkResourceProperties() { } + public string GroupId { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RequiredMembers { get { throw null; } } + public System.Collections.Generic.IList RequiredZoneNames { get { throw null; } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResourceProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class AttestationPrivateLinkServiceConnectionState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AttestationPrivateLinkServiceConnectionState() { } public string ActionsRequired { get { throw null; } set { } } public string Description { get { throw null; } set { } } public Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus? Status { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -235,7 +296,10 @@ public AttestationProviderCreateOrUpdateContent(Azure.Core.AzureLocation locatio public Azure.Core.AzureLocation Location { get { throw null; } } public Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams Properties { get { throw null; } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderCreateOrUpdateContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderCreateOrUpdateContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.Models.AttestationProviderCreateOrUpdateContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationProviderCreateOrUpdateContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -245,21 +309,60 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class AttestationProviderPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AttestationProviderPatch() { } - public Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? AttestationServicePatchSpecificParamsPublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties Properties { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderPatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderPatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.Models.AttestationProviderPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationProviderPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class AttestationProviderPatchProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AttestationProviderPatchProperties() { } + public Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType? TpmAttestationAuthentication { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Attestation.Models.AttestationProviderPatchProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AttestationPublicNetworkAccessType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AttestationPublicNetworkAccessType(string value) { throw null; } + public static Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType Disabled { get { throw null; } } + public static Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType left, Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType right) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType left, Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType right) { throw null; } + public override string ToString() { throw null; } + } public partial class AttestationServiceCreationSpecificParams : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public AttestationServiceCreationSpecificParams() { } - public System.Collections.Generic.IList PolicySigningCertificatesKeys { get { throw null; } } - public Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } + public System.Collections.Generic.IList PolicySigningCertificatesKeys { get { throw null; } } + public Azure.ResourceManager.Attestation.Models.AttestationPublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType? TpmAttestationAuthentication { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -280,50 +383,25 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Attestation.Models.AttestationServiceStatus left, Azure.ResourceManager.Attestation.Models.AttestationServiceStatus right) { throw null; } public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationServiceStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.AttestationServiceStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Attestation.Models.AttestationServiceStatus left, Azure.ResourceManager.Attestation.Models.AttestationServiceStatus right) { throw null; } public override string ToString() { throw null; } } - public partial class JsonWebKey : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public JsonWebKey(string kty) { } - public string Alg { get { throw null; } set { } } - public string Crv { get { throw null; } set { } } - public string D { get { throw null; } set { } } - public string Dp { get { throw null; } set { } } - public string Dq { get { throw null; } set { } } - public string E { get { throw null; } set { } } - public string K { get { throw null; } set { } } - public string Kid { get { throw null; } set { } } - public string Kty { get { throw null; } } - public string N { get { throw null; } set { } } - public string P { get { throw null; } set { } } - public string Q { get { throw null; } set { } } - public string Qi { get { throw null; } set { } } - public string Use { get { throw null; } set { } } - public string X { get { throw null; } set { } } - public System.Collections.Generic.IList X5C { get { throw null; } } - public string Y { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.Attestation.Models.JsonWebKey System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.Attestation.Models.JsonWebKey System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct PublicNetworkAccessType : System.IEquatable + public readonly partial struct TpmAttestationAuthenticationType : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; - public PublicNetworkAccessType(string value) { throw null; } - public static Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType Disabled { get { throw null; } } - public static Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType Enabled { get { throw null; } } - public bool Equals(Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType other) { throw null; } + public TpmAttestationAuthenticationType(string value) { throw null; } + public static Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType Disabled { get { throw null; } } + public static Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType other) { throw null; } public override bool Equals(object obj) { throw null; } public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType left, Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType right) { throw null; } - public static implicit operator Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType left, Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType right) { throw null; } + public static bool operator ==(Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType left, Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType right) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType left, Azure.ResourceManager.Attestation.Models.TpmAttestationAuthenticationType right) { throw null; } public override string ToString() { throw null; } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/assets.json b/sdk/attestation/Azure.ResourceManager.Attestation/assets.json index 7af02bd6218c..e562c348306b 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/assets.json +++ b/sdk/attestation/Azure.ResourceManager.Attestation/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/attestation/Azure.ResourceManager.Attestation", - "Tag": "net/attestation/Azure.ResourceManager.Attestation_68e2f40d08" + "Tag": "net/attestation/Azure.ResourceManager.Attestation_e942b92556" } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/metadata.json b/sdk/attestation/Azure.ResourceManager.Attestation/metadata.json new file mode 100644 index 000000000000..1d18782049bb --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/metadata.json @@ -0,0 +1,3 @@ +{ + "apiVersion": "2021-06-01" +} \ No newline at end of file diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Azure.ResourceManager.Attestation.csproj b/sdk/attestation/Azure.ResourceManager.Attestation/src/Azure.ResourceManager.Attestation.csproj index 7056f7640bae..d175d3e0612d 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Azure.ResourceManager.Attestation.csproj +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Azure.ResourceManager.Attestation.csproj @@ -4,7 +4,6 @@ Azure.ResourceManager.Attestation Microsoft Azure Resource Manager client SDK for Azure resource provider Microsoft.Attestation. azure;management;arm;resource manager;attestation - true diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/ArmAttestationModelFactory.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/ArmAttestationModelFactory.cs index eb7b662d223e..23f6e8f42a1e 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/ArmAttestationModelFactory.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/ArmAttestationModelFactory.cs @@ -9,81 +9,82 @@ using System.Collections.Generic; using System.Linq; using Azure.Core; +using Azure.ResourceManager.Attestation; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Attestation.Models { - /// Model factory for models. + /// A factory class for creating instances of the models for mocking. public static partial class ArmAttestationModelFactory { - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. /// Trust model for the attestation provider. /// Status of attestation service. /// Gets the uri of attestation service. /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. /// List of private endpoint connections associated with the attestation provider. + /// The setting that controls whether authentication is enabled or disabled for TPM Attestation REST APIs. /// A new instance for mocking. - public static AttestationProviderData AttestationProviderData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string trustModel = null, AttestationServiceStatus? status = null, Uri attestUri = null, PublicNetworkAccessType? publicNetworkAccess = null, IEnumerable privateEndpointConnections = null) + public static AttestationProviderData AttestationProviderData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string trustModel = default, AttestationServiceStatus? status = default, Uri attestUri = default, AttestationPublicNetworkAccessType? publicNetworkAccess = default, IEnumerable privateEndpointConnections = default, TpmAttestationAuthenticationType? tpmAttestationAuthentication = default) { - tags ??= new Dictionary(); - privateEndpointConnections ??= new List(); + tags ??= new ChangeTrackingDictionary(); return new AttestationProviderData( id, name, resourceType, systemData, + additionalBinaryDataProperties: null, tags, location, - trustModel, - status, - attestUri, - publicNetworkAccess, - privateEndpointConnections?.ToList(), - serializedAdditionalRawData: null); + trustModel is null && status is null && attestUri is null && publicNetworkAccess is null && privateEndpointConnections is null && tpmAttestationAuthentication is null ? default : new StatusResult( + trustModel, + status, + attestUri, + publicNetworkAccess, + (privateEndpointConnections ?? new ChangeTrackingList()).ToList(), + tpmAttestationAuthentication, + null)); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The resource of private end point. - /// A collection of information about the state of the connection between service consumer and provider. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// A collection of information about the state of the connection between service consumer and provider. /// The provisioning state of the private endpoint connection resource. + /// The resource identifier of the private endpoint. /// A new instance for mocking. - public static AttestationPrivateEndpointConnectionData AttestationPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string privateEndpointStringId = null, AttestationPrivateLinkServiceConnectionState connectionState = null, AttestationPrivateEndpointConnectionProvisioningState? provisioningState = null) + public static AttestationPrivateEndpointConnectionData AttestationPrivateEndpointConnectionData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, AttestationPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default, AttestationPrivateEndpointConnectionProvisioningState? provisioningState = default, ResourceIdentifier privateEndpointId = default) { return new AttestationPrivateEndpointConnectionData( id, name, resourceType, systemData, - privateEndpointStringId != null ? new PrivateEndpoint(privateEndpointStringId, serializedAdditionalRawData: null) : null, - connectionState, - provisioningState, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null, + privateLinkServiceConnectionState is null && provisioningState is null && privateEndpointId is null ? default : new PrivateEndpointConnectionProperties(new PrivateEndpoint(privateEndpointId, null), privateLinkServiceConnectionState, provisioningState, null)); } - /// Initializes a new instance of . + /// Parameters for creating an attestation provider. /// The supported Azure location where the attestation provider should be created. /// The tags that will be assigned to the attestation provider. /// Properties of the attestation provider. /// A new instance for mocking. - public static AttestationProviderCreateOrUpdateContent AttestationProviderCreateOrUpdateContent(AzureLocation location = default, IDictionary tags = null, AttestationServiceCreationSpecificParams properties = null) + public static AttestationProviderCreateOrUpdateContent AttestationProviderCreateOrUpdateContent(AzureLocation location = default, IDictionary tags = default, AttestationServiceCreationSpecificParams properties = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); - return new AttestationProviderCreateOrUpdateContent(location, tags, properties, serializedAdditionalRawData: null); + return new AttestationProviderCreateOrUpdateContent(location, tags, properties, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// The AttestationJsonWebKey. /// /// The "alg" (algorithm) parameter identifies the algorithm intended for /// use with the key. The values used should either be registered in the @@ -136,12 +137,12 @@ public static AttestationProviderCreateOrUpdateContent AttestationProviderCreate /// certificate. /// /// Y coordinate for the Elliptic Curve point. - /// A new instance for mocking. - public static JsonWebKey JsonWebKey(string alg = null, string crv = null, string d = null, string dp = null, string dq = null, string e = null, string k = null, string kid = null, string kty = null, string n = null, string p = null, string q = null, string qi = null, string use = null, string x = null, IEnumerable x5C = null, string y = null) + /// A new instance for mocking. + public static AttestationJsonWebKey AttestationJsonWebKey(string alg = default, string crv = default, string d = default, string dp = default, string dq = default, string e = default, string k = default, string kid = default, string kty = default, string n = default, string p = default, string q = default, string qi = default, string use = default, string x = default, IEnumerable x5C = default, string y = default) { - x5C ??= new List(); + x5C ??= new ChangeTrackingList(); - return new JsonWebKey( + return new AttestationJsonWebKey( alg, crv, d, @@ -157,34 +158,51 @@ public static JsonWebKey JsonWebKey(string alg = null, string crv = null, string qi, use, x, - x5C?.ToList(), + x5C.ToList(), y, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The private link resource group id. - /// The private link resource required member names. - /// The private link resource Private link DNS zone name. - /// A new instance for mocking. - public static AttestationPrivateLinkResource AttestationPrivateLinkResource(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string groupId = null, IEnumerable requiredMembers = null, IEnumerable requiredZoneNames = null) + /// Parameters for patching an attestation provider. + /// The tags that will be assigned to the attestation provider. + /// Properties of the attestation provider. + /// A new instance for mocking. + public static AttestationProviderPatch AttestationProviderPatch(IDictionary tags = default, AttestationProviderPatchProperties properties = default) { - requiredMembers ??= new List(); - requiredZoneNames ??= new List(); + tags ??= new ChangeTrackingDictionary(); + + return new AttestationProviderPatch(tags, properties, additionalBinaryDataProperties: null); + } + /// A private link resource. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource properties. + /// A new instance for mocking. + public static AttestationPrivateLinkResource AttestationPrivateLinkResource(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, AttestationPrivateLinkResourceProperties properties = default) + { return new AttestationPrivateLinkResource( id, name, resourceType, systemData, - groupId, - requiredMembers?.ToList(), - requiredZoneNames?.ToList(), - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null, + properties); + } + + /// Properties of a private link resource. + /// The private link resource group id. + /// The private link resource required member names. + /// The private link resource private link DNS zone name. + /// A new instance for mocking. + public static AttestationPrivateLinkResourceProperties AttestationPrivateLinkResourceProperties(string groupId = default, IEnumerable requiredMembers = default, IEnumerable requiredZoneNames = default) + { + requiredMembers ??= new ChangeTrackingList(); + requiredZoneNames ??= new ChangeTrackingList(); + + return new AttestationPrivateLinkResourceProperties(groupId, requiredMembers.ToList(), requiredZoneNames.ToList(), additionalBinaryDataProperties: null); } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionCollection.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionCollection.cs index fc0e3c4afe3d..c957e99aa2d8 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionCollection.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionCollection.cs @@ -8,67 +8,66 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.Attestation { /// /// A class representing a collection of and their operations. /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetAttestationPrivateEndpointConnections method from an instance of . + /// To get a instance call the GetAttestationPrivateEndpointConnections method from an instance of . /// public partial class AttestationPrivateEndpointConnectionCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics; - private readonly PrivateEndpointConnectionsRestOperations _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient; + private readonly ClientDiagnostics _privateEndpointConnectionsClientDiagnostics; + private readonly PrivateEndpointConnections _privateEndpointConnectionsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of AttestationPrivateEndpointConnectionCollection for mocking. protected AttestationPrivateEndpointConnectionCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. + /// The identifier of the resource that is the target of operations. internal AttestationPrivateEndpointConnectionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Attestation", AttestationPrivateEndpointConnectionResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(AttestationPrivateEndpointConnectionResource.ResourceType, out string attestationPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); - _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient = new PrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, attestationPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(AttestationPrivateEndpointConnectionResource.ResourceType, out string attestationPrivateEndpointConnectionApiVersion); + _privateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Attestation", AttestationPrivateEndpointConnectionResource.ResourceType.Namespace, Diagnostics); + _privateEndpointConnectionsRestClient = new PrivateEndpointConnections(_privateEndpointConnectionsClientDiagnostics, Pipeline, Endpoint, attestationPrivateEndpointConnectionApiVersion ?? "2021-06-01"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != AttestationProviderResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, AttestationProviderResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, AttestationProviderResource.ResourceType), id); + } } /// /// Update the state of specified private endpoint connection associated with the attestation provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Create + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// PrivateEndpointConnections_Create. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// @@ -76,23 +75,31 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the private endpoint connection associated with the Azure resource. /// The private endpoint connection properties. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string privateEndpointConnectionName, AttestationPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.CreateOrUpdate"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken).ConfigureAwait(false); - var uri = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new AttestationArmOperation(Response.FromValue(new AttestationPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, AttestationPrivateEndpointConnectionData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(AttestationPrivateEndpointConnectionData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + AttestationArmOperation operation = new AttestationArmOperation(Response.FromValue(new AttestationPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -106,20 +113,16 @@ public virtual async Task /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Create + /// Operation Id. + /// PrivateEndpointConnections_Create. /// /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// @@ -127,23 +130,31 @@ public virtual async Task The name of the private endpoint connection associated with the Azure resource. /// The private endpoint connection properties. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string privateEndpointConnectionName, AttestationPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.CreateOrUpdate"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.CreateOrUpdate"); scope.Start(); try { - var response = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken); - var uri = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new AttestationArmOperation(Response.FromValue(new AttestationPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, AttestationPrivateEndpointConnectionData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(AttestationPrivateEndpointConnectionData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + AttestationArmOperation operation = new AttestationArmOperation(Response.FromValue(new AttestationPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -157,38 +168,42 @@ public virtual ArmOperation Create /// Gets the specified private endpoint connection associated with the attestation provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.Get"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.Get"); scope.Start(); try { - var response = await _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(AttestationPrivateEndpointConnectionData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new AttestationPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -202,38 +217,42 @@ public virtual async Task /// Gets the specified private endpoint connection associated with the attestation provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Get(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.Get"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.Get"); scope.Start(); try { - var response = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(AttestationPrivateEndpointConnectionData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new AttestationPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -247,49 +266,44 @@ public virtual Response Get(string /// List all the private endpoint connections associated with the attestation provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections. /// /// - /// Operation Id - /// PrivateEndpointConnections_List + /// Operation Id. + /// PrivateEndpointConnections_List. /// /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AttestationPrivateEndpointConnectionResource(Client, AttestationPrivateEndpointConnectionData.DeserializeAttestationPrivateEndpointConnectionData(e)), _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AttestationPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new PrivateEndpointConnectionsGetAllAsyncCollectionResultOfT(_privateEndpointConnectionsRestClient, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context), data => new AttestationPrivateEndpointConnectionResource(Client, data)); } /// /// List all the private endpoint connections associated with the attestation provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections - /// - /// - /// Operation Id - /// PrivateEndpointConnections_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// PrivateEndpointConnections_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// @@ -297,44 +311,61 @@ public virtual AsyncPageable GetAl /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AttestationPrivateEndpointConnectionResource(Client, AttestationPrivateEndpointConnectionData.DeserializeAttestationPrivateEndpointConnectionData(e)), _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "AttestationPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new PrivateEndpointConnectionsGetAllCollectionResultOfT(_privateEndpointConnectionsRestClient, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context), data => new AttestationPrivateEndpointConnectionResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> ExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.Exists"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.Exists"); scope.Start(); try { - var response = await _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(AttestationPrivateEndpointConnectionData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((AttestationPrivateEndpointConnectionData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -348,36 +379,50 @@ public virtual async Task> ExistsAsync(string privateEndpointConn /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Exists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.Exists"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.Exists"); scope.Start(); try { - var response = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(AttestationPrivateEndpointConnectionData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((AttestationPrivateEndpointConnectionData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -391,38 +436,54 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.GetIfExists"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.GetIfExists"); scope.Start(); try { - var response = await _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(AttestationPrivateEndpointConnectionData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((AttestationPrivateEndpointConnectionData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new AttestationPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -436,38 +497,54 @@ public virtual async Task /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.GetIfExists"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.GetIfExists"); scope.Start(); try { - var response = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(AttestationPrivateEndpointConnectionData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((AttestationPrivateEndpointConnectionData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new AttestationPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -487,6 +564,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.Serialization.cs index 06c18d84d276..4f3fa3cbc5be 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.Serialization.cs @@ -10,16 +10,18 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.Attestation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Attestation { - public partial class AttestationPrivateEndpointConnectionData : IUtf8JsonSerializable, IJsonModel + /// The Private Endpoint Connection resource. + public partial class AttestationPrivateEndpointConnectionData : ResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,148 +33,114 @@ void IJsonModel.Write(Utf8JsonWriter w /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationPrivateEndpointConnectionData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(PrivateEndpoint)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("privateEndpoint"u8); - writer.WriteObjectValue(PrivateEndpoint, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (Optional.IsDefined(ConnectionState)) - { - writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState, options); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - writer.WriteEndObject(); } - AttestationPrivateEndpointConnectionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AttestationPrivateEndpointConnectionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (AttestationPrivateEndpointConnectionData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationPrivateEndpointConnectionData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAttestationPrivateEndpointConnectionData(document.RootElement, options); } - internal static AttestationPrivateEndpointConnectionData DeserializeAttestationPrivateEndpointConnectionData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AttestationPrivateEndpointConnectionData DeserializeAttestationPrivateEndpointConnectionData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - PrivateEndpoint privateEndpoint = default; - AttestationPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default; - AttestationPrivateEndpointConnectionProvisioningState? provisioningState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + PrivateEndpointConnectionProperties properties = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (prop.NameEquals("id"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("name"u8)) { - name = property.Value.GetString(); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("type"u8)) { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("systemData"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerAttestationContext.Default); + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerAttestationContext.Default); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("privateEndpoint"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateEndpoint = PrivateEndpoint.DeserializePrivateEndpoint(property0.Value, options); - continue; - } - if (property0.NameEquals("privateLinkServiceConnectionState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateLinkServiceConnectionState = AttestationPrivateLinkServiceConnectionState.DeserializeAttestationPrivateLinkServiceConnectionState(property0.Value, options); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new AttestationPrivateEndpointConnectionProvisioningState(property0.Value.GetString()); - continue; - } - } + properties = PrivateEndpointConnectionProperties.DeserializePrivateEndpointConnectionProperties(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new AttestationPrivateEndpointConnectionData( id, name, - type, + resourceType, systemData, - privateEndpoint, - privateLinkServiceConnectionState, - provisioningState, - serializedAdditionalRawData); + additionalBinaryDataProperties, + properties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -182,15 +150,20 @@ BinaryData IPersistableModel.Write(Mod } } - AttestationPrivateEndpointConnectionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + AttestationPrivateEndpointConnectionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (AttestationPrivateEndpointConnectionData)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeAttestationPrivateEndpointConnectionData(document.RootElement, options); } default: @@ -198,6 +171,26 @@ AttestationPrivateEndpointConnectionData IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(AttestationPrivateEndpointConnectionData attestationPrivateEndpointConnectionData) + { + if (attestationPrivateEndpointConnectionData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(attestationPrivateEndpointConnectionData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static AttestationPrivateEndpointConnectionData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAttestationPrivateEndpointConnectionData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.cs index 2a76d26b4ebb..7e531fff5bd7 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.cs @@ -13,43 +13,11 @@ namespace Azure.ResourceManager.Attestation { - /// - /// A class representing the AttestationPrivateEndpointConnection data model. - /// The Private Endpoint Connection resource. - /// + /// The Private Endpoint Connection resource. public partial class AttestationPrivateEndpointConnectionData : ResourceData { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public AttestationPrivateEndpointConnectionData() @@ -57,33 +25,54 @@ public AttestationPrivateEndpointConnectionData() } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The resource of private end point. - /// A collection of information about the state of the connection between service consumer and provider. - /// The provisioning state of the private endpoint connection resource. - /// Keeps track of any properties unknown to the library. - internal AttestationPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PrivateEndpoint privateEndpoint, AttestationPrivateLinkServiceConnectionState connectionState, AttestationPrivateEndpointConnectionProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource properties. + internal AttestationPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, PrivateEndpointConnectionProperties properties) : base(id, name, resourceType, systemData) { - PrivateEndpoint = privateEndpoint; - ConnectionState = connectionState; - ProvisioningState = provisioningState; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// The resource of private end point. - internal PrivateEndpoint PrivateEndpoint { get; set; } - /// The ARM identifier for Private Endpoint. - public string PrivateEndpointStringId + /// Resource properties. + internal PrivateEndpointConnectionProperties Properties { get; set; } + + /// A collection of information about the state of the connection between service consumer and provider. + public AttestationPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { - get => PrivateEndpoint is null ? default : PrivateEndpoint.StringId; + get + { + return Properties is null ? default : Properties.PrivateLinkServiceConnectionState; + } + set + { + if (Properties is null) + { + Properties = new PrivateEndpointConnectionProperties(); + } + Properties.PrivateLinkServiceConnectionState = value; + } } - /// A collection of information about the state of the connection between service consumer and provider. - public AttestationPrivateLinkServiceConnectionState ConnectionState { get; set; } /// The provisioning state of the private endpoint connection resource. - public AttestationPrivateEndpointConnectionProvisioningState? ProvisioningState { get; } + public AttestationPrivateEndpointConnectionProvisioningState? ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + + /// The resource identifier of the private endpoint. + public ResourceIdentifier PrivateEndpointId + { + get + { + return Properties is null ? default : Properties.PrivateEndpointId; + } + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionResource.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionResource.Serialization.cs index cb47ad2970dc..099ada842849 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionResource.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.Attestation { + /// public partial class AttestationPrivateEndpointConnectionResource : IJsonModel { - private static AttestationPrivateEndpointConnectionData s_dataDeserializationInstance; - private static AttestationPrivateEndpointConnectionData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new AttestationPrivateEndpointConnectionData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - AttestationPrivateEndpointConnectionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + /// The reader for deserializing the model. + /// The client options for reading and writing models. + AttestationPrivateEndpointConnectionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + /// The client options for reading and writing models. BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerAttestationContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. AttestationPrivateEndpointConnectionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerAttestationContext.Default); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionResource.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionResource.cs index 9b0fe9a725e8..1903652be5be 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionResource.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionResource.cs @@ -6,46 +6,35 @@ #nullable disable using System; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.Attestation { /// - /// A Class representing an AttestationPrivateEndpointConnection along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetAttestationPrivateEndpointConnectionResource method. - /// Otherwise you can get one from its parent resource using the GetAttestationPrivateEndpointConnection method. + /// A class representing a AttestationPrivateEndpointConnection along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetAttestationPrivateEndpointConnections method. /// public partial class AttestationPrivateEndpointConnectionResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The providerName. - /// The privateEndpointConnectionName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics; - private readonly PrivateEndpointConnectionsRestOperations _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient; + private readonly ClientDiagnostics _privateEndpointConnectionsClientDiagnostics; + private readonly PrivateEndpointConnections _privateEndpointConnectionsRestClient; private readonly AttestationPrivateEndpointConnectionData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.Attestation/attestationProviders/privateEndpointConnections"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of AttestationPrivateEndpointConnectionResource for mocking. protected AttestationPrivateEndpointConnectionResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The resource that is the target of operations. internal AttestationPrivateEndpointConnectionResource(ArmClient client, AttestationPrivateEndpointConnectionData data) : this(client, data.Id) @@ -54,71 +43,93 @@ internal AttestationPrivateEndpointConnectionResource(ArmClient client, Attestat _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal AttestationPrivateEndpointConnectionResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Attestation", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string attestationPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); - _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient = new PrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, attestationPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string attestationPrivateEndpointConnectionApiVersion); + _privateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Attestation", ResourceType.Namespace, Diagnostics); + _privateEndpointConnectionsRestClient = new PrivateEndpointConnections(_privateEndpointConnectionsClientDiagnostics, Pipeline, Endpoint, attestationPrivateEndpointConnectionApiVersion ?? "2021-06-01"); + ValidateResourceId(id); } /// Gets whether or not the current instance has data. public virtual bool HasData { get; } /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. public virtual AttestationPrivateEndpointConnectionData Data { get { if (!HasData) + { throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } return _data; } } + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The providerName. + /// The privateEndpointConnectionName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Gets the specified private endpoint connection associated with the attestation provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Default Api Version. + /// 2021-06-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionResource.Get"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionResource.Get"); scope.Start(); try { - var response = await _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(AttestationPrivateEndpointConnectionData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new AttestationPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -132,33 +143,41 @@ public virtual async Task /// Gets the specified private endpoint connection associated with the attestation provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Default Api Version. + /// 2021-06-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionResource.Get"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionResource.Get"); scope.Start(); try { - var response = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(AttestationPrivateEndpointConnectionData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new AttestationPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -172,20 +191,20 @@ public virtual Response Get(Cancel /// Deletes the specified private endpoint connection associated with the attestation provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Delete + /// Operation Id. + /// PrivateEndpointConnections_Delete. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Default Api Version. + /// 2021-06-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -193,16 +212,23 @@ public virtual Response Get(Cancel /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionResource.Delete"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionResource.Delete"); scope.Start(); try { - var response = await _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new AttestationArmOperation(response, rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + AttestationArmOperation operation = new AttestationArmOperation(response, rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -216,20 +242,20 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// Deletes the specified private endpoint connection associated with the attestation provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Delete + /// Operation Id. + /// PrivateEndpointConnections_Delete. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Default Api Version. + /// 2021-06-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -237,16 +263,23 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionResource.Delete"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionResource.Delete"); scope.Start(); try { - var response = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var uri = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new AttestationArmOperation(response, rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + AttestationArmOperation operation = new AttestationArmOperation(response, rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -257,23 +290,23 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Update the state of specified private endpoint connection associated with the attestation provider. + /// Update a AttestationPrivateEndpointConnection. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Create + /// Operation Id. + /// PrivateEndpointConnections_Create. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Default Api Version. + /// 2021-06-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -285,16 +318,24 @@ public virtual async Task(Response.FromValue(new AttestationPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, AttestationPrivateEndpointConnectionData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(AttestationPrivateEndpointConnectionData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + AttestationArmOperation operation = new AttestationArmOperation(Response.FromValue(new AttestationPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -305,23 +346,23 @@ public virtual async Task - /// Update the state of specified private endpoint connection associated with the attestation provider. + /// Update a AttestationPrivateEndpointConnection. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Create + /// Operation Id. + /// PrivateEndpointConnections_Create. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Default Api Version. + /// 2021-06-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -333,16 +374,24 @@ public virtual ArmOperation Update { Argument.AssertNotNull(data, nameof(data)); - using var scope = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionResource.Update"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionResource.Update"); scope.Start(); try { - var response = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var uri = _attestationPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new AttestationArmOperation(Response.FromValue(new AttestationPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, AttestationPrivateEndpointConnectionData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(AttestationPrivateEndpointConnectionData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + AttestationArmOperation operation = new AttestationArmOperation(Response.FromValue(new AttestationPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderCollection.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderCollection.cs index 14a9c223a49a..49438215900e 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderCollection.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderCollection.cs @@ -8,12 +8,13 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; using Azure.ResourceManager.Attestation.Models; using Azure.ResourceManager.Resources; @@ -22,55 +23,57 @@ namespace Azure.ResourceManager.Attestation /// /// A class representing a collection of and their operations. /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetAttestationProviders method from an instance of . + /// To get a instance call the GetAttestationProviders method from an instance of . /// public partial class AttestationProviderCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _attestationProviderClientDiagnostics; - private readonly AttestationProvidersRestOperations _attestationProviderRestClient; + private readonly ClientDiagnostics _attestationProvidersClientDiagnostics; + private readonly AttestationProviders _attestationProvidersRestClient; + private readonly ClientDiagnostics _privateLinkResourcesClientDiagnostics; + private readonly PrivateLinkResources _privateLinkResourcesRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of AttestationProviderCollection for mocking. protected AttestationProviderCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. + /// The identifier of the resource that is the target of operations. internal AttestationProviderCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _attestationProviderClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Attestation", AttestationProviderResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(AttestationProviderResource.ResourceType, out string attestationProviderApiVersion); - _attestationProviderRestClient = new AttestationProvidersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, attestationProviderApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _attestationProvidersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Attestation", AttestationProviderResource.ResourceType.Namespace, Diagnostics); + _attestationProvidersRestClient = new AttestationProviders(_attestationProvidersClientDiagnostics, Pipeline, Endpoint, attestationProviderApiVersion ?? "2021-06-01"); + _privateLinkResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Attestation", AttestationProviderResource.ResourceType.Namespace, Diagnostics); + _privateLinkResourcesRestClient = new PrivateLinkResources(_privateLinkResourcesClientDiagnostics, Pipeline, Endpoint, attestationProviderApiVersion ?? "2021-06-01"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != ResourceGroupResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), id); + } } /// - /// Creates a new Attestation Provider. + /// Creates or updates an Attestation Provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} - /// - /// - /// Operation Id - /// AttestationProviders_Create + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// AttestationProviders_Create. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// @@ -78,23 +81,31 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// Name of the attestation provider. /// Client supplied parameters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string providerName, AttestationProviderCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); Argument.AssertNotNull(content, nameof(content)); - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderCollection.CreateOrUpdate"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _attestationProviderRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, content, cancellationToken).ConfigureAwait(false); - var uri = _attestationProviderRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, providerName, content); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new AttestationArmOperation(Response.FromValue(new AttestationProviderResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, AttestationProviderCreateOrUpdateContent.ToRequestContent(content), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + AttestationArmOperation operation = new AttestationArmOperation(Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -105,23 +116,19 @@ public virtual async Task> CreateOrUpd } /// - /// Creates a new Attestation Provider. + /// Creates or updates an Attestation Provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Operation Id - /// AttestationProviders_Create + /// Operation Id. + /// AttestationProviders_Create. /// /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// @@ -129,23 +136,31 @@ public virtual async Task> CreateOrUpd /// Name of the attestation provider. /// Client supplied parameters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string providerName, AttestationProviderCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); Argument.AssertNotNull(content, nameof(content)); - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderCollection.CreateOrUpdate"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderCollection.CreateOrUpdate"); scope.Start(); try { - var response = _attestationProviderRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, providerName, content, cancellationToken); - var uri = _attestationProviderRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, providerName, content); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new AttestationArmOperation(Response.FromValue(new AttestationProviderResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, AttestationProviderCreateOrUpdateContent.ToRequestContent(content), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + AttestationArmOperation operation = new AttestationArmOperation(Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -159,38 +174,42 @@ public virtual ArmOperation CreateOrUpdate(WaitUnti /// Get the status of Attestation Provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Operation Id - /// AttestationProviders_Get + /// Operation Id. + /// AttestationProviders_Get. /// /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// Name of the attestation provider. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetAsync(string providerName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderCollection.Get"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderCollection.Get"); scope.Start(); try { - var response = await _attestationProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -204,38 +223,42 @@ public virtual async Task> GetAsync(string /// Get the status of Attestation Provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} - /// - /// - /// Operation Id - /// AttestationProviders_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// AttestationProviders_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// Name of the attestation provider. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Get(string providerName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderCollection.Get"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderCollection.Get"); scope.Start(); try { - var response = _attestationProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, providerName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -249,49 +272,44 @@ public virtual Response Get(string providerName, Ca /// Returns attestation providers list in a resource group. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders. /// /// - /// Operation Id - /// AttestationProviders_ListByResourceGroup + /// Operation Id. + /// AttestationProviders_ListByResourceGroup. /// /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _attestationProviderRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), _attestationProviderClientDiagnostics, Pipeline, "AttestationProviderCollection.GetAll", "value", null, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new AttestationProvidersGetByResourceGroupAsyncCollectionResultOfT(_attestationProvidersRestClient, Id.SubscriptionId, Id.ResourceGroupName, context), data => new AttestationProviderResource(Client, data)); } /// /// Returns attestation providers list in a resource group. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders - /// - /// - /// Operation Id - /// AttestationProviders_ListByResourceGroup + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// AttestationProviders_ListByResourceGroup. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// @@ -299,44 +317,61 @@ public virtual AsyncPageable GetAllAsync(Cancellati /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _attestationProviderRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), _attestationProviderClientDiagnostics, Pipeline, "AttestationProviderCollection.GetAll", "value", null, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new AttestationProvidersGetByResourceGroupCollectionResultOfT(_attestationProvidersRestClient, Id.SubscriptionId, Id.ResourceGroupName, context), data => new AttestationProviderResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} - /// - /// - /// Operation Id - /// AttestationProviders_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// AttestationProviders_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// Name of the attestation provider. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> ExistsAsync(string providerName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderCollection.Exists"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderCollection.Exists"); scope.Start(); try { - var response = await _attestationProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((AttestationProviderData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -350,36 +385,50 @@ public virtual async Task> ExistsAsync(string providerName, Cance /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Operation Id - /// AttestationProviders_Get + /// Operation Id. + /// AttestationProviders_Get. /// /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// Name of the attestation provider. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Exists(string providerName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderCollection.Exists"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderCollection.Exists"); scope.Start(); try { - var response = _attestationProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, providerName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((AttestationProviderData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -393,38 +442,54 @@ public virtual Response Exists(string providerName, CancellationToken canc /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} - /// - /// - /// Operation Id - /// AttestationProviders_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// AttestationProviders_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// Name of the attestation provider. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetIfExistsAsync(string providerName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderCollection.GetIfExists"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderCollection.GetIfExists"); scope.Start(); try { - var response = await _attestationProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((AttestationProviderData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -438,38 +503,54 @@ public virtual async Task> GetIfEx /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Operation Id - /// AttestationProviders_Get + /// Operation Id. + /// AttestationProviders_Get. /// /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// Name of the attestation provider. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual NullableResponse GetIfExists(string providerName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderCollection.GetIfExists"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderCollection.GetIfExists"); scope.Start(); try { - var response = _attestationProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, providerName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((AttestationProviderData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -489,6 +570,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.Serialization.cs index 104fba2d0c81..2d3533e695ee 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.Serialization.cs @@ -10,16 +10,23 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.Attestation.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Attestation { - public partial class AttestationProviderData : IUtf8JsonSerializable, IJsonModel + /// Attestation service response message. + public partial class AttestationProviderData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal AttestationProviderData() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,209 +38,144 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationProviderData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(TrustModel)) - { - writer.WritePropertyName("trustModel"u8); - writer.WriteStringValue(TrustModel); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); - } - if (Optional.IsDefined(AttestUri)) - { - writer.WritePropertyName("attestUri"u8); - writer.WriteStringValue(AttestUri.AbsoluteUri); - } - if (Optional.IsDefined(PublicNetworkAccess)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("publicNetworkAccess"u8); - writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && Optional.IsCollectionDefined(PrivateEndpointConnections)) - { - writer.WritePropertyName("privateEndpointConnections"u8); - writer.WriteStartArray(); - foreach (var item in PrivateEndpointConnections) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); } - AttestationProviderData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AttestationProviderData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (AttestationProviderData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationProviderData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAttestationProviderData(document.RootElement, options); } - internal static AttestationProviderData DeserializeAttestationProviderData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AttestationProviderData DeserializeAttestationProviderData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string trustModel = default; - AttestationServiceStatus? status = default; - Uri attestUri = default; - PublicNetworkAccessType? publicNetworkAccess = default; - IReadOnlyList privateEndpointConnections = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + StatusResult properties = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("systemData"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerAttestationContext.Default); + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerAttestationContext.Default); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("trustModel"u8)) - { - trustModel = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("status"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new AttestationServiceStatus(property0.Value.GetString()); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("attestUri"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - attestUri = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("publicNetworkAccess"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - publicNetworkAccess = new PublicNetworkAccessType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("privateEndpointConnections"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(AttestationPrivateEndpointConnectionData.DeserializeAttestationPrivateEndpointConnectionData(item, options)); - } - privateEndpointConnections = array; - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = StatusResult.DeserializeStatusResult(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new AttestationProviderData( id, name, - type, + resourceType, systemData, + additionalBinaryDataProperties, tags ?? new ChangeTrackingDictionary(), location, - trustModel, - status, - attestUri, - publicNetworkAccess, - privateEndpointConnections ?? new ChangeTrackingList(), - serializedAdditionalRawData); + properties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -243,15 +185,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt } } - AttestationProviderData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + AttestationProviderData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (AttestationProviderData)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeAttestationProviderData(document.RootElement, options); } default: @@ -259,6 +206,14 @@ AttestationProviderData IPersistableModel.Create(Binary } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static AttestationProviderData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAttestationProviderData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.cs index 095695205626..975c9baa15a6 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.cs @@ -13,88 +13,132 @@ namespace Azure.ResourceManager.Attestation { - /// - /// A class representing the AttestationProvider data model. - /// Attestation service response message. - /// + /// Attestation service response message. public partial class AttestationProviderData : TrackedResourceData { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// The location. + /// The geo-location where the resource lives. public AttestationProviderData(AzureLocation location) : base(location) { - PrivateEndpointConnections = new ChangeTrackingList(); } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// Trust model for the attestation provider. - /// Status of attestation service. - /// Gets the uri of attestation service. - /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. - /// List of private endpoint connections associated with the attestation provider. - /// Keeps track of any properties unknown to the library. - internal AttestationProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string trustModel, AttestationServiceStatus? status, Uri attestUri, PublicNetworkAccessType? publicNetworkAccess, IReadOnlyList privateEndpointConnections, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// Describes Attestation service status. + internal AttestationProviderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, StatusResult properties) : base(id, name, resourceType, systemData, tags, location) { - TrustModel = trustModel; - Status = status; - AttestUri = attestUri; - PublicNetworkAccess = publicNetworkAccess; - PrivateEndpointConnections = privateEndpointConnections; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal AttestationProviderData() + /// Describes Attestation service status. + internal StatusResult Properties { get; set; } + + /// Trust model for the attestation provider. + public string TrustModel { + get + { + return Properties is null ? default : Properties.TrustModel; + } + set + { + if (Properties is null) + { + Properties = new StatusResult(); + } + Properties.TrustModel = value; + } } - /// Trust model for the attestation provider. - public string TrustModel { get; set; } /// Status of attestation service. - public AttestationServiceStatus? Status { get; set; } + public AttestationServiceStatus? Status + { + get + { + return Properties is null ? default : Properties.Status; + } + set + { + if (Properties is null) + { + Properties = new StatusResult(); + } + Properties.Status = value.Value; + } + } + /// Gets the uri of attestation service. - public Uri AttestUri { get; set; } + public Uri AttestUri + { + get + { + return Properties is null ? default : Properties.AttestUri; + } + set + { + if (Properties is null) + { + Properties = new StatusResult(); + } + Properties.AttestUri = value; + } + } + /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. - public PublicNetworkAccessType? PublicNetworkAccess { get; set; } + public AttestationPublicNetworkAccessType? PublicNetworkAccess + { + get + { + return Properties is null ? default : Properties.PublicNetworkAccess; + } + set + { + if (Properties is null) + { + Properties = new StatusResult(); + } + Properties.PublicNetworkAccess = value.Value; + } + } + /// List of private endpoint connections associated with the attestation provider. - public IReadOnlyList PrivateEndpointConnections { get; } + public IReadOnlyList PrivateEndpointConnections + { + get + { + if (Properties is null) + { + Properties = new StatusResult(); + } + return Properties.PrivateEndpointConnections; + } + } + + /// The setting that controls whether authentication is enabled or disabled for TPM Attestation REST APIs. + public TpmAttestationAuthenticationType? TpmAttestationAuthentication + { + get + { + return Properties is null ? default : Properties.TpmAttestationAuthentication; + } + set + { + if (Properties is null) + { + Properties = new StatusResult(); + } + Properties.TpmAttestationAuthentication = value.Value; + } + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.Serialization.cs index 549c36dfd8e4..77f0a0d6aef1 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.Attestation { + /// public partial class AttestationProviderResource : IJsonModel { - private static AttestationProviderData s_dataDeserializationInstance; - private static AttestationProviderData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new AttestationProviderData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - AttestationProviderData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + /// The reader for deserializing the model. + /// The client options for reading and writing models. + AttestationProviderData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + /// The client options for reading and writing models. BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerAttestationContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. AttestationProviderData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerAttestationContext.Default); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.cs index 0b32392e72c9..f508162a51c4 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.cs @@ -7,50 +7,39 @@ using System; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; using Azure.ResourceManager.Attestation.Models; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Attestation { /// - /// A Class representing an AttestationProvider along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetAttestationProviderResource method. - /// Otherwise you can get one from its parent resource using the GetAttestationProvider method. + /// A class representing a AttestationProvider along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetAttestationProviders method. /// public partial class AttestationProviderResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The providerName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string providerName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _attestationProviderClientDiagnostics; - private readonly AttestationProvidersRestOperations _attestationProviderRestClient; + private readonly ClientDiagnostics _attestationProvidersClientDiagnostics; + private readonly AttestationProviders _attestationProvidersRestClient; private readonly ClientDiagnostics _privateLinkResourcesClientDiagnostics; - private readonly PrivateLinkResourcesRestOperations _privateLinkResourcesRestClient; + private readonly PrivateLinkResources _privateLinkResourcesRestClient; private readonly AttestationProviderData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.Attestation/attestationProviders"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of AttestationProviderResource for mocking. protected AttestationProviderResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The resource that is the target of operations. internal AttestationProviderResource(ArmClient client, AttestationProviderData data) : this(client, data.Id) @@ -59,142 +48,94 @@ internal AttestationProviderResource(ArmClient client, AttestationProviderData d _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal AttestationProviderResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _attestationProviderClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Attestation", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string attestationProviderApiVersion); - _attestationProviderRestClient = new AttestationProvidersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, attestationProviderApiVersion); - _privateLinkResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Attestation", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _privateLinkResourcesRestClient = new PrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); -#if DEBUG - ValidateResourceId(Id); -#endif + _attestationProvidersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Attestation", ResourceType.Namespace, Diagnostics); + _attestationProvidersRestClient = new AttestationProviders(_attestationProvidersClientDiagnostics, Pipeline, Endpoint, attestationProviderApiVersion ?? "2021-06-01"); + _privateLinkResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Attestation", ResourceType.Namespace, Diagnostics); + _privateLinkResourcesRestClient = new PrivateLinkResources(_privateLinkResourcesClientDiagnostics, Pipeline, Endpoint, attestationProviderApiVersion ?? "2021-06-01"); + ValidateResourceId(id); } /// Gets whether or not the current instance has data. public virtual bool HasData { get; } /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. public virtual AttestationProviderData Data { get { if (!HasData) + { throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } return _data; } } - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// Gets a collection of AttestationPrivateEndpointConnectionResources in the AttestationProvider. - /// An object representing collection of AttestationPrivateEndpointConnectionResources and their operations over a AttestationPrivateEndpointConnectionResource. - public virtual AttestationPrivateEndpointConnectionCollection GetAttestationPrivateEndpointConnections() - { - return GetCachedClient(client => new AttestationPrivateEndpointConnectionCollection(client, Id)); - } - - /// - /// Gets the specified private endpoint connection associated with the attestation provider. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the private endpoint connection associated with the Azure resource. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetAttestationPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The providerName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string providerName) { - return await GetAttestationPrivateEndpointConnections().GetAsync(privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}"; + return new ResourceIdentifier(resourceId); } - /// - /// Gets the specified private endpoint connection associated with the attestation provider. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the private endpoint connection associated with the Azure resource. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetAttestationPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetAttestationPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Get the status of Attestation Provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Operation Id - /// AttestationProviders_Get + /// Operation Id. + /// AttestationProviders_Get. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Default Api Version. + /// 2021-06-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderResource.Get"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderResource.Get"); scope.Start(); try { - var response = await _attestationProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -208,33 +149,41 @@ public virtual async Task> GetAsync(Cancel /// Get the status of Attestation Provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Operation Id - /// AttestationProviders_Get + /// Operation Id. + /// AttestationProviders_Get. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Default Api Version. + /// 2021-06-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderResource.Get"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderResource.Get"); scope.Start(); try { - var response = _attestationProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -245,41 +194,49 @@ public virtual Response Get(CancellationToken cance } /// - /// Delete Attestation Service. + /// Updates the Attestation Provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Operation Id - /// AttestationProviders_Delete + /// Operation Id. + /// AttestationProviders_Update. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Default Api Version. + /// 2021-06-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Client supplied parameters. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(AttestationProviderPatch patch, CancellationToken cancellationToken = default) { - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderResource.Update"); scope.Start(); try { - var response = await _attestationProviderRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _attestationProviderRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new AttestationArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, AttestationProviderPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -289,41 +246,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete Attestation Service. + /// Updates the Attestation Provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Operation Id - /// AttestationProviders_Delete + /// Operation Id. + /// AttestationProviders_Update. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Default Api Version. + /// 2021-06-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Client supplied parameters. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(AttestationProviderPatch patch, CancellationToken cancellationToken = default) { - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderResource.Update"); scope.Start(); try { - var response = _attestationProviderRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var uri = _attestationProviderRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new AttestationArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, AttestationProviderPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -333,39 +298,48 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Updates the Attestation Provider. + /// Delete Attestation Service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Operation Id - /// AttestationProviders_Update + /// Operation Id. + /// AttestationProviders_Delete. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Default Api Version. + /// 2021-06-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// Client supplied parameters. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(AttestationProviderPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderResource.Update"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderResource.Delete"); scope.Start(); try { - var response = await _attestationProviderRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + AttestationArmOperation operation = new AttestationArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -375,39 +349,48 @@ public virtual async Task> UpdateAsync(Att } /// - /// Updates the Attestation Provider. + /// Delete Attestation Service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Operation Id - /// AttestationProviders_Update + /// Operation Id. + /// AttestationProviders_Delete. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Default Api Version. + /// 2021-06-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// Client supplied parameters. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(AttestationProviderPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderResource.Update"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderResource.Delete"); scope.Start(); try { - var response = _attestationProviderRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + AttestationArmOperation operation = new AttestationArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -420,73 +403,67 @@ public virtual Response Update(AttestationProviderP /// Gets the private link resources supported for the attestation provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateLinkResources + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateLinkResources. + /// + /// + /// Operation Id. + /// AttestationProviders_ListByProvider. /// /// - /// Operation Id - /// PrivateLinkResources_ListByProvider + /// Default Api Version. + /// 2021-06-01. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Resource. + /// . /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPrivateLinkResourcesByProviderAsync(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPrivateLinkResourcesAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListByProviderRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => AttestationPrivateLinkResource.DeserializeAttestationPrivateLinkResource(e), _privateLinkResourcesClientDiagnostics, Pipeline, "AttestationProviderResource.GetPrivateLinkResourcesByProvider", "value", null, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PrivateLinkResourcesGetPrivateLinkResourcesAsyncCollectionResultOfT(_privateLinkResourcesRestClient, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); } /// /// Gets the private link resources supported for the attestation provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateLinkResources + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateLinkResources. + /// + /// + /// Operation Id. + /// AttestationProviders_ListByProvider. /// /// - /// Operation Id - /// PrivateLinkResources_ListByProvider + /// Default Api Version. + /// 2021-06-01. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Resource. + /// . /// /// /// /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPrivateLinkResourcesByProvider(CancellationToken cancellationToken = default) + public virtual Pageable GetPrivateLinkResources(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListByProviderRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => AttestationPrivateLinkResource.DeserializeAttestationPrivateLinkResource(e), _privateLinkResourcesClientDiagnostics, Pipeline, "AttestationProviderResource.GetPrivateLinkResourcesByProvider", "value", null, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PrivateLinkResourcesGetPrivateLinkResourcesCollectionResultOfT(_privateLinkResourcesRestClient, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} - /// - /// - /// Operation Id - /// AttestationProviders_Get - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -496,29 +473,35 @@ public virtual async Task> AddTagAsync(str Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderResource.AddTag"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderResource.AddTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues[key] = value; - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _attestationProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AttestationProviderResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new AttestationProviderPatch(); - foreach (var tag in current.Tags) + AttestationProviderData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + AttestationProviderPatch patch = new AttestationProviderPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + Response result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -528,27 +511,7 @@ public virtual async Task> AddTagAsync(str } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} - /// - /// - /// Operation Id - /// AttestationProviders_Get - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -558,29 +521,35 @@ public virtual Response AddTag(string key, string v Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderResource.AddTag"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderResource.AddTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _attestationProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new AttestationProviderResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new AttestationProviderPatch(); - foreach (var tag in current.Tags) + AttestationProviderData current = Get(cancellationToken: cancellationToken).Value.Data; + AttestationProviderPatch patch = new AttestationProviderPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = Update(patch, cancellationToken: cancellationToken); - return result; + Response result = Update(patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -590,54 +559,40 @@ public virtual Response AddTag(string key, string v } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} - /// - /// - /// Operation Id - /// AttestationProviders_Get - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderResource.SetTags"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderResource.SetTags"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.ReplaceWith(tags); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _attestationProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AttestationProviderResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new AttestationProviderPatch(); + AttestationProviderData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + AttestationProviderPatch patch = new AttestationProviderPatch(); patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + Response result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -647,54 +602,40 @@ public virtual async Task> SetTagsAsync(ID } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} - /// - /// - /// Operation Id - /// AttestationProviders_Get - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderResource.SetTags"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderResource.SetTags"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _attestationProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new AttestationProviderResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new AttestationProviderPatch(); + AttestationProviderData current = Get(cancellationToken: cancellationToken).Value.Data; + AttestationProviderPatch patch = new AttestationProviderPatch(); patch.Tags.ReplaceWith(tags); - var result = Update(patch, cancellationToken: cancellationToken); - return result; + Response result = Update(patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -704,27 +645,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} - /// - /// - /// Operation Id - /// AttestationProviders_Get - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -732,29 +653,35 @@ public virtual async Task> RemoveTagAsync( { Argument.AssertNotNull(key, nameof(key)); - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderResource.RemoveTag"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderResource.RemoveTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.Remove(key); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _attestationProviderRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AttestationProviderResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new AttestationProviderPatch(); - foreach (var tag in current.Tags) + AttestationProviderData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + AttestationProviderPatch patch = new AttestationProviderPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + Response result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -764,27 +691,7 @@ public virtual async Task> RemoveTagAsync( } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} - /// - /// - /// Operation Id - /// AttestationProviders_Get - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -792,29 +699,35 @@ public virtual Response RemoveTag(string key, Cance { Argument.AssertNotNull(key, nameof(key)); - using var scope = _attestationProviderClientDiagnostics.CreateScope("AttestationProviderResource.RemoveTag"); + using DiagnosticScope scope = _attestationProvidersClientDiagnostics.CreateScope("AttestationProviderResource.RemoveTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _attestationProviderRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new AttestationProviderResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _attestationProvidersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new AttestationProviderPatch(); - foreach (var tag in current.Tags) + AttestationProviderData current = Get(cancellationToken: cancellationToken).Value.Data; + AttestationProviderPatch patch = new AttestationProviderPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = Update(patch, cancellationToken: cancellationToken); - return result; + Response result = Update(patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -823,5 +736,38 @@ public virtual Response RemoveTag(string key, Cance throw; } } + + /// Gets a collection of AttestationPrivateEndpointConnections in the . + /// An object representing collection of AttestationPrivateEndpointConnections and their operations over a AttestationPrivateEndpointConnectionResource. + public virtual AttestationPrivateEndpointConnectionCollection GetAttestationPrivateEndpointConnections() + { + return GetCachedClient(client => new AttestationPrivateEndpointConnectionCollection(client, Id)); + } + + /// Gets the specified private endpoint connection associated with the attestation provider. + /// The name of the private endpoint connection associated with the Azure resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAttestationPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + return await GetAttestationPrivateEndpointConnections().GetAsync(privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + } + + /// Gets the specified private endpoint connection associated with the attestation provider. + /// The name of the private endpoint connection associated with the Azure resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAttestationPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + return GetAttestationPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetAllAsyncCollectionResultOfT.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..fcb535c17c85 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Attestation.Models; + +namespace Azure.ResourceManager.Attestation +{ + internal partial class AttestationProvidersGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly AttestationProviders _client; + private readonly string _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of AttestationProvidersGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The AttestationProviders client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public AttestationProvidersGetAllAsyncCollectionResultOfT(AttestationProviders client, string subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of AttestationProvidersGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of AttestationProvidersGetAllAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Response response = await GetNextResponseAsync(pageSizeHint, null).ConfigureAwait(false); + AttestationProviderListResult result = AttestationProviderListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, null, response); + } + + /// Get next page. + /// The number of items per page. + /// A continuation token indicating where to resume paging. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, string continuationToken) + { + HttpMessage message = _client.CreateGetAllRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableAttestationSubscriptionResource.GetAttestationProviders"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetAllCollectionResultOfT.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..8d9781257129 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetAllCollectionResultOfT.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Attestation.Models; + +namespace Azure.ResourceManager.Attestation +{ + internal partial class AttestationProvidersGetAllCollectionResultOfT : Pageable + { + private readonly AttestationProviders _client; + private readonly string _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of AttestationProvidersGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The AttestationProviders client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public AttestationProvidersGetAllCollectionResultOfT(AttestationProviders client, string subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of AttestationProvidersGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of AttestationProvidersGetAllCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Response response = GetNextResponse(pageSizeHint, null); + AttestationProviderListResult result = AttestationProviderListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, null, response); + } + + /// Get next page. + /// The number of items per page. + /// A continuation token indicating where to resume paging. + private Response GetNextResponse(int? pageSizeHint, string continuationToken) + { + HttpMessage message = _client.CreateGetAllRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableAttestationSubscriptionResource.GetAttestationProviders"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetByResourceGroupAsyncCollectionResultOfT.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetByResourceGroupAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..85e24a352ddf --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetByResourceGroupAsyncCollectionResultOfT.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Attestation.Models; + +namespace Azure.ResourceManager.Attestation +{ + internal partial class AttestationProvidersGetByResourceGroupAsyncCollectionResultOfT : AsyncPageable + { + private readonly AttestationProviders _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of AttestationProvidersGetByResourceGroupAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The AttestationProviders client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public AttestationProvidersGetByResourceGroupAsyncCollectionResultOfT(AttestationProviders client, string subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of AttestationProvidersGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of AttestationProvidersGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Response response = await GetNextResponseAsync(pageSizeHint, null).ConfigureAwait(false); + AttestationProviderListResult result = AttestationProviderListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, null, response); + } + + /// Get next page. + /// The number of items per page. + /// A continuation token indicating where to resume paging. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, string continuationToken) + { + HttpMessage message = _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("AttestationProviderCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetByResourceGroupCollectionResultOfT.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetByResourceGroupCollectionResultOfT.cs new file mode 100644 index 000000000000..472fef33ca58 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetByResourceGroupCollectionResultOfT.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Attestation.Models; + +namespace Azure.ResourceManager.Attestation +{ + internal partial class AttestationProvidersGetByResourceGroupCollectionResultOfT : Pageable + { + private readonly AttestationProviders _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of AttestationProvidersGetByResourceGroupCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The AttestationProviders client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public AttestationProvidersGetByResourceGroupCollectionResultOfT(AttestationProviders client, string subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of AttestationProvidersGetByResourceGroupCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of AttestationProvidersGetByResourceGroupCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Response response = GetNextResponse(pageSizeHint, null); + AttestationProviderListResult result = AttestationProviderListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, null, response); + } + + /// Get next page. + /// The number of items per page. + /// A continuation token indicating where to resume paging. + private Response GetNextResponse(int? pageSizeHint, string continuationToken) + { + HttpMessage message = _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("AttestationProviderCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetDefaultAttestationProviderAsyncCollectionResultOfT.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetDefaultAttestationProviderAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..24e6785ec1ee --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetDefaultAttestationProviderAsyncCollectionResultOfT.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Attestation.Models; + +namespace Azure.ResourceManager.Attestation +{ + internal partial class AttestationProvidersGetDefaultAttestationProviderAsyncCollectionResultOfT : AsyncPageable + { + private readonly AttestationProviders _client; + private readonly string _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of AttestationProvidersGetDefaultAttestationProviderAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The AttestationProviders client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public AttestationProvidersGetDefaultAttestationProviderAsyncCollectionResultOfT(AttestationProviders client, string subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of AttestationProvidersGetDefaultAttestationProviderAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of AttestationProvidersGetDefaultAttestationProviderAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Response response = await GetNextResponseAsync(pageSizeHint, null).ConfigureAwait(false); + AttestationProviderListResult result = AttestationProviderListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, null, response); + } + + /// Get next page. + /// The number of items per page. + /// A continuation token indicating where to resume paging. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, string continuationToken) + { + HttpMessage message = _client.CreateGetDefaultAttestationProviderRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableAttestationSubscriptionResource.GetDefaultAttestationProvider"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetDefaultAttestationProviderCollectionResultOfT.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetDefaultAttestationProviderCollectionResultOfT.cs new file mode 100644 index 000000000000..ce02ff6546a6 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/AttestationProvidersGetDefaultAttestationProviderCollectionResultOfT.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Attestation.Models; + +namespace Azure.ResourceManager.Attestation +{ + internal partial class AttestationProvidersGetDefaultAttestationProviderCollectionResultOfT : Pageable + { + private readonly AttestationProviders _client; + private readonly string _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of AttestationProvidersGetDefaultAttestationProviderCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The AttestationProviders client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public AttestationProvidersGetDefaultAttestationProviderCollectionResultOfT(AttestationProviders client, string subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of AttestationProvidersGetDefaultAttestationProviderCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of AttestationProvidersGetDefaultAttestationProviderCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Response response = GetNextResponse(pageSizeHint, null); + AttestationProviderListResult result = AttestationProviderListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, null, response); + } + + /// Get next page. + /// The number of items per page. + /// A continuation token indicating where to resume paging. + private Response GetNextResponse(int? pageSizeHint, string continuationToken) + { + HttpMessage message = _client.CreateGetDefaultAttestationProviderRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableAttestationSubscriptionResource.GetDefaultAttestationProvider"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/PrivateEndpointConnectionsGetAllAsyncCollectionResultOfT.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/PrivateEndpointConnectionsGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..db52a5769840 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/PrivateEndpointConnectionsGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Attestation.Models; + +namespace Azure.ResourceManager.Attestation +{ + internal partial class PrivateEndpointConnectionsGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly PrivateEndpointConnections _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _providerName; + private readonly RequestContext _context; + + /// Initializes a new instance of PrivateEndpointConnectionsGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The PrivateEndpointConnections client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the attestation provider. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public PrivateEndpointConnectionsGetAllAsyncCollectionResultOfT(PrivateEndpointConnections client, string subscriptionId, string resourceGroupName, string providerName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _providerName = providerName; + _context = context; + } + + /// Gets the pages of PrivateEndpointConnectionsGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of PrivateEndpointConnectionsGetAllAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + AttestationPrivateEndpointConnectionListResult result = AttestationPrivateEndpointConnectionListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _providerName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _providerName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/PrivateEndpointConnectionsGetAllCollectionResultOfT.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/PrivateEndpointConnectionsGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..641ccc15560e --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/PrivateEndpointConnectionsGetAllCollectionResultOfT.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Attestation.Models; + +namespace Azure.ResourceManager.Attestation +{ + internal partial class PrivateEndpointConnectionsGetAllCollectionResultOfT : Pageable + { + private readonly PrivateEndpointConnections _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _providerName; + private readonly RequestContext _context; + + /// Initializes a new instance of PrivateEndpointConnectionsGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The PrivateEndpointConnections client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the attestation provider. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public PrivateEndpointConnectionsGetAllCollectionResultOfT(PrivateEndpointConnections client, string subscriptionId, string resourceGroupName, string providerName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _providerName = providerName; + _context = context; + } + + /// Gets the pages of PrivateEndpointConnectionsGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of PrivateEndpointConnectionsGetAllCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + AttestationPrivateEndpointConnectionListResult result = AttestationPrivateEndpointConnectionListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _providerName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _providerName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("AttestationPrivateEndpointConnectionCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/PrivateLinkResourcesGetPrivateLinkResourcesAsyncCollectionResultOfT.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/PrivateLinkResourcesGetPrivateLinkResourcesAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..02c74e4e8a9b --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/PrivateLinkResourcesGetPrivateLinkResourcesAsyncCollectionResultOfT.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Attestation.Models; + +namespace Azure.ResourceManager.Attestation +{ + internal partial class PrivateLinkResourcesGetPrivateLinkResourcesAsyncCollectionResultOfT : AsyncPageable + { + private readonly PrivateLinkResources _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _providerName; + private readonly RequestContext _context; + + /// Initializes a new instance of PrivateLinkResourcesGetPrivateLinkResourcesAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The PrivateLinkResources client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the attestation provider. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public PrivateLinkResourcesGetPrivateLinkResourcesAsyncCollectionResultOfT(PrivateLinkResources client, string subscriptionId, string resourceGroupName, string providerName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _providerName = providerName; + _context = context; + } + + /// Gets the pages of PrivateLinkResourcesGetPrivateLinkResourcesAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of PrivateLinkResourcesGetPrivateLinkResourcesAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Response response = await GetNextResponseAsync(pageSizeHint, null).ConfigureAwait(false); + AttestationPrivateLinkResourceListResult result = AttestationPrivateLinkResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, null, response); + } + + /// Get next page. + /// The number of items per page. + /// A continuation token indicating where to resume paging. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, string continuationToken) + { + HttpMessage message = _client.CreateGetPrivateLinkResourcesRequest(_subscriptionId, _resourceGroupName, _providerName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("AttestationProviderResource.GetPrivateLinkResources"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/PrivateLinkResourcesGetPrivateLinkResourcesCollectionResultOfT.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/PrivateLinkResourcesGetPrivateLinkResourcesCollectionResultOfT.cs new file mode 100644 index 000000000000..adacd6076743 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/CollectionResults/PrivateLinkResourcesGetPrivateLinkResourcesCollectionResultOfT.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Attestation.Models; + +namespace Azure.ResourceManager.Attestation +{ + internal partial class PrivateLinkResourcesGetPrivateLinkResourcesCollectionResultOfT : Pageable + { + private readonly PrivateLinkResources _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _providerName; + private readonly RequestContext _context; + + /// Initializes a new instance of PrivateLinkResourcesGetPrivateLinkResourcesCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The PrivateLinkResources client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the attestation provider. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public PrivateLinkResourcesGetPrivateLinkResourcesCollectionResultOfT(PrivateLinkResources client, string subscriptionId, string resourceGroupName, string providerName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _providerName = providerName; + _context = context; + } + + /// Gets the pages of PrivateLinkResourcesGetPrivateLinkResourcesCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of PrivateLinkResourcesGetPrivateLinkResourcesCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Response response = GetNextResponse(pageSizeHint, null); + AttestationPrivateLinkResourceListResult result = AttestationPrivateLinkResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, null, response); + } + + /// Get next page. + /// The number of items per page. + /// A continuation token indicating where to resume paging. + private Response GetNextResponse(int? pageSizeHint, string continuationToken) + { + HttpMessage message = _client.CreateGetPrivateLinkResourcesRequest(_subscriptionId, _resourceGroupName, _providerName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("AttestationProviderResource.GetPrivateLinkResources"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/AttestationExtensions.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/AttestationExtensions.cs index c8e35f06d1cf..82ecbec64fb4 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/AttestationExtensions.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/AttestationExtensions.cs @@ -8,7 +8,9 @@ using System; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; using Azure.ResourceManager.Attestation.Mocking; using Azure.ResourceManager.Resources; @@ -17,30 +19,32 @@ namespace Azure.ResourceManager.Attestation /// A class to add extension methods to Azure.ResourceManager.Attestation. public static partial class AttestationExtensions { + /// private static MockableAttestationArmClient GetMockableAttestationArmClient(ArmClient client) { - return client.GetCachedClient(client0 => new MockableAttestationArmClient(client0)); + return client.GetCachedClient(client0 => new MockableAttestationArmClient(client0, ResourceIdentifier.Root)); } - private static MockableAttestationResourceGroupResource GetMockableAttestationResourceGroupResource(ArmResource resource) + /// + private static MockableAttestationResourceGroupResource GetMockableAttestationResourceGroupResource(ResourceGroupResource resourceGroupResource) { - return resource.GetCachedClient(client => new MockableAttestationResourceGroupResource(client, resource.Id)); + return resourceGroupResource.GetCachedClient(client => new MockableAttestationResourceGroupResource(client, resourceGroupResource.Id)); } - private static MockableAttestationSubscriptionResource GetMockableAttestationSubscriptionResource(ArmResource resource) + /// + private static MockableAttestationSubscriptionResource GetMockableAttestationSubscriptionResource(SubscriptionResource subscriptionResource) { - return resource.GetCachedClient(client => new MockableAttestationSubscriptionResource(client, resource.Id)); + return subscriptionResource.GetCachedClient(client => new MockableAttestationSubscriptionResource(client, subscriptionResource.Id)); } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. /// Returns a object. @@ -52,14 +56,13 @@ public static AttestationProviderResource GetAttestationProviderResource(this Ar } /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. /// Returns a object. @@ -71,15 +74,15 @@ public static AttestationPrivateEndpointConnectionResource GetAttestationPrivate } /// - /// Gets a collection of AttestationProviderResources in the ResourceGroupResource. + /// Gets a collection of AttestationProviders in the /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// is null. - /// An object representing collection of AttestationProviderResources and their operations over a AttestationProviderResource. + /// An object representing collection of AttestationProviders and their operations over a AttestationProviderResource. public static AttestationProviderCollection GetAttestationProviders(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); @@ -89,34 +92,15 @@ public static AttestationProviderCollection GetAttestationProviders(this Resourc /// /// Get the status of Attestation Provider. - /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} - /// - /// - /// Operation Id - /// AttestationProviders_Get - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// Name of the attestation provider. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] public static async Task> GetAttestationProviderAsync(this ResourceGroupResource resourceGroupResource, string providerName, CancellationToken cancellationToken = default) { @@ -127,34 +111,15 @@ public static async Task> GetAttestationPr /// /// Get the status of Attestation Provider. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} - /// - /// - /// Operation Id - /// AttestationProviders_Get - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// Name of the attestation provider. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] public static Response GetAttestationProvider(this ResourceGroupResource resourceGroupResource, string providerName, CancellationToken cancellationToken = default) { @@ -165,33 +130,15 @@ public static Response GetAttestationProvider(this /// /// Returns a list of attestation providers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders - /// - /// - /// Operation Id - /// AttestationProviders_List - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public static AsyncPageable GetAttestationProvidersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); @@ -201,30 +148,12 @@ public static AsyncPageable GetAttestationProviders /// /// Returns a list of attestation providers in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders - /// - /// - /// Operation Id - /// AttestationProviders_List - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The cancellation token to use. /// is null. /// A collection of that may take multiple service requests to iterate over. @@ -237,146 +166,74 @@ public static Pageable GetAttestationProviders(this /// /// Get the default provider - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders - /// - /// - /// Operation Id - /// AttestationProviders_ListDefault - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetAttestationProvidersByDefaultProviderAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetDefaultAttestationProviderAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableAttestationSubscriptionResource(subscriptionResource).GetAttestationProvidersByDefaultProviderAsync(cancellationToken); + return GetMockableAttestationSubscriptionResource(subscriptionResource).GetDefaultAttestationProviderAsync(cancellationToken); } /// /// Get the default provider - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders - /// - /// - /// Operation Id - /// AttestationProviders_ListDefault - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The cancellation token to use. /// is null. /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetAttestationProvidersByDefaultProvider(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + public static Pageable GetDefaultAttestationProvider(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableAttestationSubscriptionResource(subscriptionResource).GetAttestationProvidersByDefaultProvider(cancellationToken); + return GetMockableAttestationSubscriptionResource(subscriptionResource).GetDefaultAttestationProvider(cancellationToken); } /// /// Get the default provider by location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider - /// - /// - /// Operation Id - /// AttestationProviders_GetDefaultByLocation - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. - /// The location of the default provider. + /// The the method will execute against. + /// The name of the Azure region. /// The cancellation token to use. /// is null. - public static async Task> GetDefaultByLocationAttestationProviderAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + public static async Task> GetDefaultAttestationProviderByLocationAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableAttestationSubscriptionResource(subscriptionResource).GetDefaultByLocationAttestationProviderAsync(location, cancellationToken).ConfigureAwait(false); + return await GetMockableAttestationSubscriptionResource(subscriptionResource).GetDefaultAttestationProviderByLocationAsync(location, cancellationToken).ConfigureAwait(false); } /// /// Get the default provider by location. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider - /// - /// - /// Operation Id - /// AttestationProviders_GetDefaultByLocation - /// - /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// - /// - /// /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. - /// The location of the default provider. + /// The the method will execute against. + /// The name of the Azure region. /// The cancellation token to use. /// is null. - public static Response GetDefaultByLocationAttestationProvider(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + public static Response GetDefaultAttestationProviderByLocation(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableAttestationSubscriptionResource(subscriptionResource).GetDefaultByLocationAttestationProvider(location, cancellationToken); + return GetMockableAttestationSubscriptionResource(subscriptionResource).GetDefaultAttestationProviderByLocation(location, cancellationToken); } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationArmClient.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationArmClient.cs index f4b685cbd634..3fb53d05c76d 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationArmClient.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationArmClient.cs @@ -6,38 +6,27 @@ #nullable disable using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Mocking { - /// A class to add extension methods to ArmClient. + /// A class to add extension methods to . public partial class MockableAttestationArmClient : ArmResource { - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableAttestationArmClient for mocking. protected MockableAttestationArmClient() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal MockableAttestationArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) { } - internal MockableAttestationArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. /// Returns a object. public virtual AttestationProviderResource GetAttestationProviderResource(ResourceIdentifier id) @@ -46,10 +35,7 @@ public virtual AttestationProviderResource GetAttestationProviderResource(Resour return new AttestationProviderResource(Client, id); } - /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. /// Returns a object. public virtual AttestationPrivateEndpointConnectionResource GetAttestationPrivateEndpointConnectionResource(ResourceIdentifier id) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationResourceGroupResource.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationResourceGroupResource.cs index 73a9a51e458c..1f5eb68b4f3f 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationResourceGroupResource.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationResourceGroupResource.cs @@ -8,33 +8,31 @@ using System; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Attestation; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Attestation.Mocking { - /// A class to add extension methods to ResourceGroupResource. + /// A class to add extension methods to . public partial class MockableAttestationResourceGroupResource : ArmResource { - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableAttestationResourceGroupResource for mocking. protected MockableAttestationResourceGroupResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal MockableAttestationResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) { } - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of AttestationProviderResources in the ResourceGroupResource. - /// An object representing collection of AttestationProviderResources and their operations over a AttestationProviderResource. + /// Gets a collection of AttestationProviders in the . + /// An object representing collection of AttestationProviders and their operations over a AttestationProviderResource. public virtual AttestationProviderCollection GetAttestationProviders() { return GetCachedClient(client => new AttestationProviderCollection(client, Id)); @@ -44,20 +42,16 @@ public virtual AttestationProviderCollection GetAttestationProviders() /// Get the status of Attestation Provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} - /// - /// - /// Operation Id - /// AttestationProviders_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// AttestationProviders_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// @@ -68,6 +62,8 @@ public virtual AttestationProviderCollection GetAttestationProviders() [ForwardsClientCalls] public virtual async Task> GetAttestationProviderAsync(string providerName, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + return await GetAttestationProviders().GetAsync(providerName, cancellationToken).ConfigureAwait(false); } @@ -75,20 +71,16 @@ public virtual async Task> GetAttestationP /// Get the status of Attestation Provider. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName} - /// - /// - /// Operation Id - /// AttestationProviders_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// AttestationProviders_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// @@ -99,6 +91,8 @@ public virtual async Task> GetAttestationP [ForwardsClientCalls] public virtual Response GetAttestationProvider(string providerName, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + return GetAttestationProviders().Get(providerName, cancellationToken); } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationSubscriptionResource.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationSubscriptionResource.cs index ba946f6e6456..e5da4fd0c5b6 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationSubscriptionResource.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Extensions/MockableAttestationSubscriptionResource.cs @@ -8,86 +8,79 @@ using System; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Attestation; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Attestation.Mocking { - /// A class to add extension methods to SubscriptionResource. + /// A class to add extension methods to . public partial class MockableAttestationSubscriptionResource : ArmResource { - private ClientDiagnostics _attestationProviderClientDiagnostics; - private AttestationProvidersRestOperations _attestationProviderRestClient; + private ClientDiagnostics _attestationProvidersClientDiagnostics; + private AttestationProviders _attestationProvidersRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableAttestationSubscriptionResource for mocking. protected MockableAttestationSubscriptionResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal MockableAttestationSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) { } - private ClientDiagnostics AttestationProviderClientDiagnostics => _attestationProviderClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Attestation", AttestationProviderResource.ResourceType.Namespace, Diagnostics); - private AttestationProvidersRestOperations AttestationProviderRestClient => _attestationProviderRestClient ??= new AttestationProvidersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AttestationProviderResource.ResourceType)); + private ClientDiagnostics AttestationProvidersClientDiagnostics => _attestationProvidersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Attestation.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } + private AttestationProviders AttestationProvidersRestClient => _attestationProvidersRestClient ??= new AttestationProviders(AttestationProvidersClientDiagnostics, Pipeline, Endpoint, "2021-06-01"); /// /// Returns a list of attestation providers in a subscription. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders. /// /// - /// Operation Id - /// AttestationProviders_List + /// Operation Id. + /// AttestationProviders_List. /// /// - /// Default Api Version - /// 2021-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAttestationProvidersAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "MockableAttestationSubscriptionResource.GetAttestationProviders", "value", null, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new AttestationProvidersGetAllAsyncCollectionResultOfT(AttestationProvidersRestClient, Id.SubscriptionId, context), data => new AttestationProviderResource(Client, data)); } /// /// Returns a list of attestation providers in a subscription. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders - /// - /// - /// Operation Id - /// AttestationProviders_List + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// AttestationProviders_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// @@ -95,98 +88,105 @@ public virtual AsyncPageable GetAttestationProvider /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAttestationProviders(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "MockableAttestationSubscriptionResource.GetAttestationProviders", "value", null, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new AttestationProvidersGetAllCollectionResultOfT(AttestationProvidersRestClient, Id.SubscriptionId, context), data => new AttestationProviderResource(Client, data)); } /// /// Get the default provider /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders - /// - /// - /// Operation Id - /// AttestationProviders_ListDefault + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// AttestationProvidersOperationGroup_ListDefault. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAttestationProvidersByDefaultProviderAsync(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDefaultAttestationProviderAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListDefaultRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "MockableAttestationSubscriptionResource.GetAttestationProvidersByDefaultProvider", "value", null, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new AttestationProvidersGetDefaultAttestationProviderAsyncCollectionResultOfT(AttestationProvidersRestClient, Id.SubscriptionId, context), data => new AttestationProviderResource(Client, data)); } /// /// Get the default provider /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders - /// - /// - /// Operation Id - /// AttestationProviders_ListDefault + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// AttestationProvidersOperationGroup_ListDefault. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAttestationProvidersByDefaultProvider(CancellationToken cancellationToken = default) + public virtual Pageable GetDefaultAttestationProvider(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => AttestationProviderRestClient.CreateListDefaultRequest(Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new AttestationProviderResource(Client, AttestationProviderData.DeserializeAttestationProviderData(e)), AttestationProviderClientDiagnostics, Pipeline, "MockableAttestationSubscriptionResource.GetAttestationProvidersByDefaultProvider", "value", null, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new AttestationProvidersGetDefaultAttestationProviderCollectionResultOfT(AttestationProvidersRestClient, Id.SubscriptionId, context), data => new AttestationProviderResource(Client, data)); } /// /// Get the default provider by location. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider - /// - /// - /// Operation Id - /// AttestationProviders_GetDefaultByLocation + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// AttestationProvidersOperationGroup_GetDefaultByLocation. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// - /// The location of the default provider. + /// The name of the Azure region. /// The cancellation token to use. - public virtual async Task> GetDefaultByLocationAttestationProviderAsync(AzureLocation location, CancellationToken cancellationToken = default) + public virtual async Task> GetDefaultAttestationProviderByLocationAsync(AzureLocation location, CancellationToken cancellationToken = default) { - using var scope = AttestationProviderClientDiagnostics.CreateScope("MockableAttestationSubscriptionResource.GetDefaultByLocationAttestationProvider"); + using DiagnosticScope scope = AttestationProvidersClientDiagnostics.CreateScope("MockableAttestationSubscriptionResource.GetDefaultAttestationProviderByLocation"); scope.Start(); try { - var response = await AttestationProviderRestClient.GetDefaultByLocationAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = AttestationProvidersRestClient.CreateGetDefaultAttestationProviderByLocationRequest(Id.SubscriptionId, location, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -200,32 +200,38 @@ public virtual async Task> GetDefaultByLoc /// Get the default provider by location. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider - /// - /// - /// Operation Id - /// AttestationProviders_GetDefaultByLocation + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider. /// /// - /// Default Api Version - /// 2021-06-01-preview + /// Operation Id. + /// AttestationProvidersOperationGroup_GetDefaultByLocation. /// /// - /// Resource - /// + /// Default Api Version. + /// 2021-06-01. /// /// /// - /// The location of the default provider. + /// The name of the Azure region. /// The cancellation token to use. - public virtual Response GetDefaultByLocationAttestationProvider(AzureLocation location, CancellationToken cancellationToken = default) + public virtual Response GetDefaultAttestationProviderByLocation(AzureLocation location, CancellationToken cancellationToken = default) { - using var scope = AttestationProviderClientDiagnostics.CreateScope("MockableAttestationSubscriptionResource.GetDefaultByLocationAttestationProvider"); + using DiagnosticScope scope = AttestationProvidersClientDiagnostics.CreateScope("MockableAttestationSubscriptionResource.GetDefaultAttestationProviderByLocation"); scope.Start(); try { - var response = AttestationProviderRestClient.GetDefaultByLocation(Id.SubscriptionId, location, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = AttestationProvidersRestClient.CreateGetDefaultAttestationProviderByLocationRequest(Id.SubscriptionId, location, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(AttestationProviderData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new AttestationProviderResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/Argument.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/Argument.cs index 871da0ab7d71..42a7daaf1e2b 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/Argument.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/Argument.cs @@ -11,8 +11,10 @@ namespace Azure.ResourceManager.Attestation { - internal static class Argument + internal static partial class Argument { + /// The value. + /// The name. public static void AssertNotNull(T value, string name) { if (value is null) @@ -21,8 +23,10 @@ public static void AssertNotNull(T value, string name) } } + /// The value. + /// The name. public static void AssertNotNull(T? value, string name) - where T : struct + where T : struct { if (!value.HasValue) { @@ -30,6 +34,8 @@ public static void AssertNotNull(T? value, string name) } } + /// The value. + /// The name. public static void AssertNotNullOrEmpty(IEnumerable value, string name) { if (value is null) @@ -51,6 +57,8 @@ public static void AssertNotNullOrEmpty(IEnumerable value, string name) } } + /// The value. + /// The name. public static void AssertNotNullOrEmpty(string value, string name) { if (value is null) @@ -62,68 +70,5 @@ public static void AssertNotNullOrEmpty(string value, string name) throw new ArgumentException("Value cannot be an empty string.", name); } } - - public static void AssertNotNullOrWhiteSpace(string value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (string.IsNullOrWhiteSpace(value)) - { - throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); - } - } - - public static void AssertNotDefault(ref T value, string name) - where T : struct, IEquatable - { - if (value.Equals(default)) - { - throw new ArgumentException("Value cannot be empty.", name); - } - } - - public static void AssertInRange(T value, T minimum, T maximum, string name) - where T : notnull, IComparable - { - if (minimum.CompareTo(value) > 0) - { - throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); - } - if (maximum.CompareTo(value) < 0) - { - throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); - } - } - - public static void AssertEnumDefined(Type enumType, object value, string name) - { - if (!Enum.IsDefined(enumType, value)) - { - throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); - } - } - - public static T CheckNotNull(T value, string name) - where T : class - { - AssertNotNull(value, name); - return value; - } - - public static string CheckNotNullOrEmpty(string value, string name) - { - AssertNotNullOrEmpty(value, name); - return value; - } - - public static void AssertNull(T value, string name, string message = null) - { - if (value != null) - { - throw new ArgumentException(message ?? "Value must be null.", name); - } - } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/AsyncPageableWrapper.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/AsyncPageableWrapper.cs new file mode 100644 index 000000000000..6a52f40b20b1 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/AsyncPageableWrapper.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; + +namespace Azure.ResourceManager.Attestation +{ + internal partial class AsyncPageableWrapper : AsyncPageable + { + /// The source async pageable value of type AsyncPageable<T>. + private AsyncPageable _source; + /// The converter function from T to U. + private Func _converter; + + /// Initializes a new instance of the AsyncPageableWrapper class. + /// The source async pageable value of type AsyncPageable<T>. + /// The converter function from T to U. + public AsyncPageableWrapper(AsyncPageable source, Func converter) + { + _source = source; + _converter = converter; + } + + /// Converts the pages from AsyncPageable to Page. + /// A continuation token from a previous response. + /// An optional hint to specify the desired size of each page. + /// An enumerable of pages containing converted items of type U. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + await foreach (Page page in _source.AsPages(continuationToken, pageSizeHint).ConfigureAwait(false)) + { + List convertedItems = new List(); + foreach (T item in page.Values) + { + convertedItems.Add(_converter.Invoke(item)); + } + yield return Page.FromValues(convertedItems, page.ContinuationToken, page.GetRawResponse()); + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ChangeTrackingDictionary.cs index 5087a6d068d3..5ca8dc3222ba 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ChangeTrackingDictionary.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -11,7 +11,8 @@ namespace Azure.ResourceManager.Attestation { - internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + internal partial class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary + where TKey : notnull { private IDictionary _innerDictionary; @@ -19,6 +20,7 @@ public ChangeTrackingDictionary() { } + /// The inner dictionary. public ChangeTrackingDictionary(IDictionary dictionary) { if (dictionary == null) @@ -28,6 +30,7 @@ public ChangeTrackingDictionary(IDictionary dictionary) _innerDictionary = new Dictionary(dictionary); } + /// The inner dictionary. public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) { if (dictionary == null) @@ -41,16 +44,22 @@ public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) } } + /// Gets the IsUndefined. public bool IsUndefined => _innerDictionary == null; + /// Gets the Count. public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + /// Gets the IsReadOnly. public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + /// Gets the Keys. public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + /// Gets the Values. public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + /// Gets or sets the value associated with the specified key. public TValue this[TKey key] { get @@ -67,8 +76,10 @@ public TValue this[TKey key] } } + /// Gets the Keys. IEnumerable IReadOnlyDictionary.Keys => Keys; + /// Gets the Values. IEnumerable IReadOnlyDictionary.Values => Values; public IEnumerator> GetEnumerator() @@ -89,6 +100,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } + /// The item to add. public void Add(KeyValuePair item) { EnsureDictionary().Add(item); @@ -99,6 +111,7 @@ public void Clear() EnsureDictionary().Clear(); } + /// The item to search for. public bool Contains(KeyValuePair item) { if (IsUndefined) @@ -108,6 +121,8 @@ public bool Contains(KeyValuePair item) return EnsureDictionary().Contains(item); } + /// The array to copy. + /// The index. public void CopyTo(KeyValuePair[] array, int index) { if (IsUndefined) @@ -117,6 +132,7 @@ public void CopyTo(KeyValuePair[] array, int index) EnsureDictionary().CopyTo(array, index); } + /// The item to remove. public bool Remove(KeyValuePair item) { if (IsUndefined) @@ -126,11 +142,14 @@ public bool Remove(KeyValuePair item) return EnsureDictionary().Remove(item); } + /// The key. + /// The value to add. public void Add(TKey key, TValue value) { EnsureDictionary().Add(key, value); } + /// The key to search for. public bool ContainsKey(TKey key) { if (IsUndefined) @@ -140,6 +159,7 @@ public bool ContainsKey(TKey key) return EnsureDictionary().ContainsKey(key); } + /// The key. public bool Remove(TKey key) { if (IsUndefined) @@ -149,6 +169,8 @@ public bool Remove(TKey key) return EnsureDictionary().Remove(key); } + /// The key to search for. + /// The value. public bool TryGetValue(TKey key, out TValue value) { if (IsUndefined) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ChangeTrackingList.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ChangeTrackingList.cs index 83bb4835a6e8..ba2589692d71 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ChangeTrackingList.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ChangeTrackingList.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Attestation { - internal class ChangeTrackingList : IList, IReadOnlyList + internal partial class ChangeTrackingList : IList, IReadOnlyList { private IList _innerList; @@ -20,6 +20,7 @@ public ChangeTrackingList() { } + /// The inner list. public ChangeTrackingList(IList innerList) { if (innerList != null) @@ -28,6 +29,7 @@ public ChangeTrackingList(IList innerList) } } + /// The inner list. public ChangeTrackingList(IReadOnlyList innerList) { if (innerList != null) @@ -36,12 +38,16 @@ public ChangeTrackingList(IReadOnlyList innerList) } } + /// Gets the IsUndefined. public bool IsUndefined => _innerList == null; + /// Gets the Count. public int Count => IsUndefined ? 0 : EnsureList().Count; + /// Gets the IsReadOnly. public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + /// Gets or sets the value associated with the specified key. public T this[int index] { get @@ -85,6 +91,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } + /// The item to add. public void Add(T item) { EnsureList().Add(item); @@ -95,6 +102,7 @@ public void Clear() EnsureList().Clear(); } + /// The item. public bool Contains(T item) { if (IsUndefined) @@ -104,6 +112,8 @@ public bool Contains(T item) return EnsureList().Contains(item); } + /// The array to copy to. + /// The array index. public void CopyTo(T[] array, int arrayIndex) { if (IsUndefined) @@ -113,6 +123,7 @@ public void CopyTo(T[] array, int arrayIndex) EnsureList().CopyTo(array, arrayIndex); } + /// The item. public bool Remove(T item) { if (IsUndefined) @@ -122,6 +133,7 @@ public bool Remove(T item) return EnsureList().Remove(item); } + /// The item. public int IndexOf(T item) { if (IsUndefined) @@ -131,11 +143,14 @@ public int IndexOf(T item) return EnsureList().IndexOf(item); } + /// The inner list. + /// The item. public void Insert(int index, T item) { EnsureList().Insert(index, item); } + /// The inner list. public void RemoveAt(int index) { if (IsUndefined) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ClientPipelineExtensions.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 000000000000..590f5b777822 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ClientPipelineExtensions.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Attestation +{ + internal static partial class ClientPipelineExtensions + { + public static async ValueTask ProcessMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + await pipeline.SendAsync(message, userCancellationToken).ConfigureAwait(false); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static Response ProcessMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + pipeline.Send(message, userCancellationToken); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static async ValueTask> ProcessHeadAsBoolMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = await pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + + public static Response ProcessHeadAsBoolMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = pipeline.ProcessMessage(message, context); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/CodeGenMemberAttribute.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/CodeGenMemberAttribute.cs new file mode 100644 index 000000000000..72778edeb7e4 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/CodeGenMemberAttribute.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] + internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute + { + /// The original name of the member. + public CodeGenMemberAttribute(string originalName) : base(originalName) + { + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/CodeGenSerializationAttribute.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/CodeGenSerializationAttribute.cs new file mode 100644 index 000000000000..dfcabf517497 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/CodeGenSerializationAttribute.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] + internal partial class CodeGenSerializationAttribute : Attribute + { + /// The property name which these hooks apply to. + public CodeGenSerializationAttribute(string propertyName) + { + PropertyName = propertyName; + } + + /// The property name which these hooks apply to. + /// The serialization name of the property. + public CodeGenSerializationAttribute(string propertyName, string serializationName) + { + PropertyName = propertyName; + SerializationName = serializationName; + } + + /// Gets or sets the property name which these hooks should apply to. + public string PropertyName { get; } + + /// Gets or sets the serialization name of the property. + public string SerializationName { get; set; } + + /// + /// Gets or sets the method name to use when serializing the property value (property name excluded). + /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer); + /// + public string SerializationValueHook { get; set; } + + /// + /// Gets or sets the method name to use when deserializing the property value from the JSON. + /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required + /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional + /// + public string DeserializationValueHook { get; set; } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/CodeGenSuppressAttribute.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/CodeGenSuppressAttribute.cs new file mode 100644 index 000000000000..38d536e69173 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/CodeGenSuppressAttribute.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] + internal partial class CodeGenSuppressAttribute : Attribute + { + /// The member to suppress. + /// The types of the parameters of the member. + public CodeGenSuppressAttribute(string member, params Type[] parameters) + { + Member = member; + Parameters = parameters; + } + + /// Gets the Member. + public string Member { get; } + + /// Gets the Parameters. + public Type[] Parameters { get; } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/CodeGenTypeAttribute.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/CodeGenTypeAttribute.cs new file mode 100644 index 000000000000..f36b5f513173 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/CodeGenTypeAttribute.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] + internal partial class CodeGenTypeAttribute : Attribute + { + /// The original name of the type. + public CodeGenTypeAttribute(string originalName) + { + OriginalName = originalName; + } + + /// Gets the OriginalName. + public string OriginalName { get; } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ErrorResult.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 000000000000..cb65e786aac2 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ErrorResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; + +namespace Azure.ResourceManager.Attestation +{ + internal partial class ErrorResult : Response + { + private readonly Response _response; + private readonly RequestFailedException _exception; + + public ErrorResult(Response response, RequestFailedException exception) + { + _response = response; + _exception = exception; + } + + /// Gets the Value. + public override T Value => throw _exception; + + /// + public override Response GetRawResponse() + { + return _response; + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ModelSerializationExtensions.cs index f7325274bf5b..00570e53a796 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/ModelSerializationExtensions.cs @@ -10,19 +10,18 @@ using System.Collections.Generic; using System.Diagnostics; using System.Globalization; +using System.Runtime.InteropServices; using System.Text.Json; -using System.Xml; -using Azure.Core; namespace Azure.ResourceManager.Attestation { - internal static class ModelSerializationExtensions + internal static partial class ModelSerializationExtensions { - internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); - internal static readonly ModelReaderWriterOptions WireV3Options = new ModelReaderWriterOptions("W|v3"); - internal static readonly ModelReaderWriterOptions JsonV3Options = new ModelReaderWriterOptions("J|v3"); - internal static readonly BinaryData SentinelValue = BinaryData.FromBytes("\"__EMPTY__\""u8.ToArray()); + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions + { + MaxDepth = 256 + }; public static object GetObject(this JsonElement element) { @@ -48,14 +47,14 @@ public static object GetObject(this JsonElement element) case JsonValueKind.Null: return null; case JsonValueKind.Object: - var dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var jsonProperty in element.EnumerateObject()) { dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); } return dictionary; case JsonValueKind.Array: - var list = new List(); + List list = new List(); foreach (var item in element.EnumerateArray()) { list.Add(item.GetObject()); @@ -93,7 +92,7 @@ public static char GetChar(this JsonElement element) { if (element.ValueKind == JsonValueKind.String) { - var text = element.GetString(); + string text = element.GetString(); if (text == null || text.Length != 1) { throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); @@ -107,14 +106,14 @@ public static char GetChar(this JsonElement element) } [Conditional("DEBUG")] - public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + public static void ThrowNonNullablePropertyIsNull(this JsonProperty @property) { - throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + throw new JsonException($"A property '{@property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); } public static string GetRequiredString(this JsonElement element) { - var value = element.GetString(); + string value = element.GetString(); if (value == null) { throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); @@ -181,9 +180,6 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, T value, Mode case IJsonModel jsonModel: jsonModel.Write(writer, options ?? WireOptions); break; - case IUtf8JsonSerializable serializable: - serializable.Write(writer); - break; case byte[] bytes: writer.WriteBase64StringValue(bytes); break; @@ -260,150 +256,13 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, object value, Mo writer.WriteObjectValue(value, options); } - internal static bool IsSentinelValue(BinaryData value) - { - ReadOnlySpan sentinelSpan = SentinelValue.ToMemory().Span; - ReadOnlySpan valueSpan = value.ToMemory().Span; - return sentinelSpan.SequenceEqual(valueSpan); - } - - internal static class TypeFormatters + public static BinaryData GetUtf8Bytes(this JsonElement element) { - private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; - public const string DefaultNumberFormat = "G"; - - public static string ToString(bool value) => value ? "true" : "false"; - - public static string ToString(DateTime value, string format) => value.Kind switch - { - DateTimeKind.Utc => ToString((DateTimeOffset)value, format), - _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") - }; - - public static string ToString(DateTimeOffset value, string format) => format switch - { - "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), - "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), - "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "R" => value.ToString("r", CultureInfo.InvariantCulture), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(TimeSpan value, string format) => format switch - { - "P" => XmlConvert.ToString(value), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(byte[] value, string format) => format switch - { - "U" => ToBase64UrlString(value), - "D" => Convert.ToBase64String(value), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - - public static string ToBase64UrlString(byte[] value) - { - int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; - int size = checked(numWholeOrPartialInputBlocks * 4); - char[] output = new char[size]; - - int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); - - int i = 0; - for (; i < numBase64Chars; i++) - { - char ch = output[i]; - if (ch == '+') - { - output[i] = '-'; - } - else - { - if (ch == '/') - { - output[i] = '_'; - } - else - { - if (ch == '=') - { - break; - } - } - } - } - - return new string(output, 0, i); - } - - public static byte[] FromBase64UrlString(string value) - { - int paddingCharsToAdd = (value.Length % 4) switch - { - 0 => 0, - 2 => 2, - 3 => 1, - _ => throw new InvalidOperationException("Malformed input") - }; - char[] output = new char[(value.Length + paddingCharsToAdd)]; - int i = 0; - for (; i < value.Length; i++) - { - char ch = value[i]; - if (ch == '-') - { - output[i] = '+'; - } - else - { - if (ch == '_') - { - output[i] = '/'; - } - else - { - output[i] = ch; - } - } - } - - for (; i < output.Length; i++) - { - output[i] = '='; - } - - return Convert.FromBase64CharArray(output, 0, output.Length); - } - - public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch - { - "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), - _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) - }; - - public static TimeSpan ParseTimeSpan(string value, string format) => format switch - { - "P" => XmlConvert.ToTimeSpan(value), - _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) - }; - - public static string ConvertToString(object value, string format = null) => value switch - { - null => "null", - string s => s, - bool b => ToString(b), - int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), - byte[] b0 when format != null => ToString(b0, format), - IEnumerable s0 => string.Join(",", s0), - DateTimeOffset dateTime when format != null => ToString(dateTime, format), - TimeSpan timeSpan when format != null => ToString(timeSpan, format), - TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), - Guid guid => guid.ToString(), - BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), - _ => value.ToString() - }; +#if NET9_0_OR_GREATER + return new global::System.BinaryData(global::System.Runtime.InteropServices.JsonMarshal.GetRawUtf8Value(element).ToArray()); +#else + return BinaryData.FromString(element.GetRawText()); +#endif } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/Optional.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/Optional.cs index e3b708a830ea..91e18e94a821 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/Optional.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/Optional.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Attestation { - internal static class Optional + internal static partial class Optional { public static bool IsCollectionDefined(IEnumerable collection) { @@ -28,7 +28,7 @@ public static bool IsCollectionDefined(IReadOnlyDictionary(T? value) - where T : struct + where T : struct { return value.HasValue; } @@ -38,14 +38,14 @@ public static bool IsDefined(object value) return value != null; } - public static bool IsDefined(JsonElement value) + public static bool IsDefined(string value) { - return value.ValueKind != JsonValueKind.Undefined; + return value != null; } - public static bool IsDefined(string value) + public static bool IsDefined(JsonElement value) { - return value != null; + return value.ValueKind != JsonValueKind.Undefined; } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/PageableWrapper.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/PageableWrapper.cs new file mode 100644 index 000000000000..4533143d3656 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/PageableWrapper.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; + +namespace Azure.ResourceManager.Attestation +{ + internal partial class PageableWrapper : Pageable + { + /// The source pageable value of type Pageable<T>. + private Pageable _source; + /// The converter function from T to U. + private Func _converter; + + /// Initializes a new instance of the PageableWrapper class. + /// The source pageable value of type Pageable<T>. + /// The converter function from T to U. + public PageableWrapper(Pageable source, Func converter) + { + _source = source; + _converter = converter; + } + + /// Converts the pages from Pageable to Page. + /// A continuation token from a previous response. + /// An optional hint to specify the desired size of each page. + /// An enumerable of pages containing converted items of type U. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + foreach (Page page in _source.AsPages(continuationToken, pageSizeHint)) + { + List convertedItems = new List(); + foreach (T item in page.Values) + { + convertedItems.Add(_converter.Invoke(item)); + } + yield return Page.FromValues(convertedItems, page.ContinuationToken, page.GetRawResponse()); + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/RawRequestUriBuilderExtensions.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/RawRequestUriBuilderExtensions.cs new file mode 100644 index 000000000000..1f1f8f07334a --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/RawRequestUriBuilderExtensions.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.ResourceManager.Attestation +{ + internal static partial class RawRequestUriBuilderExtensions + { + public static void AppendQueryDelimited(this RawRequestUriBuilder builder, string name, IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) + { + delimiter ??= ","; + IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); + builder.AppendQuery(name, string.Join(delimiter, stringValues), escape); + } + + public static void UpdateQuery(this RawRequestUriBuilder builder, string name, string value) + { + string currentQuery = builder.Query; + string searchPattern = string.Concat(name, "="); + int paramStartIndex = -1; + if (currentQuery.StartsWith(string.Concat("?", searchPattern))) + { + paramStartIndex = 1; + } + if (paramStartIndex == -1) + { + string prefixedPattern = string.Concat("&", searchPattern); + int prefixedIndex = currentQuery.IndexOf(prefixedPattern); + if (prefixedIndex >= 0) + { + paramStartIndex = prefixedIndex + 1; + } + } + if (paramStartIndex >= 0) + { + int valueStartIndex = paramStartIndex + searchPattern.Length; + int valueEndIndex = currentQuery.IndexOf('&', valueStartIndex); + if (valueEndIndex == -1) + { + valueEndIndex = currentQuery.Length; + } + string beforeParam = currentQuery.Substring(0, valueStartIndex); + string afterParam = currentQuery.Substring(valueEndIndex); + string newQuery = string.Concat(beforeParam, value, afterParam); + builder.Query = newQuery; + } + else + { + builder.AppendQuery(name, value, true); + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/RequestContextExtensions.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/RequestContextExtensions.cs new file mode 100644 index 000000000000..53f14f2943bf --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/RequestContextExtensions.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Azure; + +namespace Azure.ResourceManager.Attestation +{ + internal static partial class RequestContextExtensions + { + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + public static ValueTuple Parse(this RequestContext context) + { + if (context == null) + { + return (CancellationToken.None, ErrorOptions.Default); + } + return (context.CancellationToken, context.ErrorOptions); + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/SerializationFormat.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/SerializationFormat.cs new file mode 100644 index 000000000000..603df6b98899 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/SerializationFormat.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Attestation +{ + internal enum SerializationFormat + { + /// The default serialization format. + Default = 0, + /// The RFC1123 date time format. + DateTime_RFC1123 = 1, + /// The RFC3339 date time format. + DateTime_RFC3339 = 2, + /// The RFC7231 date time format. + DateTime_RFC7231 = 3, + /// The ISO8601 date time format. + DateTime_ISO8601 = 4, + /// The Unix date time format. + DateTime_Unix = 5, + /// The ISO8601 date format. + Date_ISO8601 = 6, + /// The ISO8601 duration format. + Duration_ISO8601 = 7, + /// The constant duration format. + Duration_Constant = 8, + /// The seconds duration format. + Duration_Seconds = 9, + /// The seconds duration format with float precision. + Duration_Seconds_Float = 10, + /// The seconds duration format with double precision. + Duration_Seconds_Double = 11, + /// The milliseconds duration format. + Duration_Milliseconds = 12, + /// The milliseconds duration format with float precision. + Duration_Milliseconds_Float = 13, + /// The milliseconds duration format with double precision. + Duration_Milliseconds_Double = 14, + /// The ISO8601 time format. + Time_ISO8601 = 15, + /// The Base64Url bytes format. + Bytes_Base64Url = 16, + /// The Base64 bytes format. + Bytes_Base64 = 17 + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/TypeFormatters.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/TypeFormatters.cs new file mode 100644 index 000000000000..88e6127450bd --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/TypeFormatters.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Xml; + +namespace Azure.ResourceManager.Attestation +{ + internal static partial class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked (value.Length + 2) / 3; + int size = checked (numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ToFormatSpecifier(SerializationFormat format) => format switch + { + SerializationFormat.DateTime_RFC1123 => "R", + SerializationFormat.DateTime_RFC3339 => "O", + SerializationFormat.DateTime_RFC7231 => "R", + SerializationFormat.DateTime_ISO8601 => "O", + SerializationFormat.Date_ISO8601 => "D", + SerializationFormat.DateTime_Unix => "U", + SerializationFormat.Bytes_Base64Url => "U", + SerializationFormat.Bytes_Base64 => "D", + SerializationFormat.Duration_ISO8601 => "P", + SerializationFormat.Duration_Constant => "c", + SerializationFormat.Duration_Seconds => "%s", + SerializationFormat.Duration_Seconds_Float => "s\\.FFF", + SerializationFormat.Duration_Seconds_Double => "s\\.FFFFFF", + SerializationFormat.Time_ISO8601 => "T", + _ => null + }; + + public static string ConvertToString(object value, SerializationFormat format = SerializationFormat.Default) + { + string formatSpecifier = ToFormatSpecifier(format); + + return value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when formatSpecifier != null => ToString(b0, formatSpecifier), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when formatSpecifier != null => ToString(dateTime, formatSpecifier), + TimeSpan timeSpan when format == SerializationFormat.Duration_Seconds => Convert.ToInt32(timeSpan.TotalSeconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan0 when format == SerializationFormat.Duration_Seconds_Float || format == SerializationFormat.Duration_Seconds_Double => timeSpan0.TotalSeconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan1 when format == SerializationFormat.Duration_Milliseconds => Convert.ToInt32(timeSpan1.TotalMilliseconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan2 when format == SerializationFormat.Duration_Milliseconds_Float || format == SerializationFormat.Duration_Milliseconds_Double => timeSpan2.TotalMilliseconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan3 when formatSpecifier != null => ToString(timeSpan3, formatSpecifier), + TimeSpan timeSpan4 => XmlConvert.ToString(timeSpan4), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/Utf8JsonRequestContent.cs index 69d2b7e0ea4b..b4b80867eb25 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/Utf8JsonRequestContent.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.Attestation { - internal class Utf8JsonRequestContent : RequestContent + internal partial class Utf8JsonRequestContent : RequestContent { private readonly MemoryStream _stream; private readonly RequestContent _content; @@ -25,20 +25,26 @@ public Utf8JsonRequestContent() JsonWriter = new Utf8JsonWriter(_stream); } + /// Gets the JsonWriter. public Utf8JsonWriter JsonWriter { get; } + /// The stream containing the data to be written. + /// The cancellation token to use. public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) { await JsonWriter.FlushAsync().ConfigureAwait(false); await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); } + /// The stream containing the data to be written. + /// The cancellation token to use. public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) { JsonWriter.Flush(); _content.WriteTo(stream, cancellationToken); } + /// public override bool TryComputeLength(out long length) { length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/LongRunningOperation/AttestationArmOperation.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/LongRunningOperation/AttestationArmOperation.cs index e3cc1695506e..65b5f4b2ef3d 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/LongRunningOperation/AttestationArmOperation.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/LongRunningOperation/AttestationArmOperation.cs @@ -6,18 +6,16 @@ #nullable disable using System; -using System.ClientModel.Primitives; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.Attestation { -#pragma warning disable SA1649 // File name should match first type name - internal class AttestationArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class AttestationArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected AttestationArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal AttestationArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response); @@ -36,12 +37,20 @@ internal AttestationArmOperation(Response response, RehydrationToken? rehydratio _operationId = GetOperationId(rehydrationToken); } + /// + /// The instance of . + /// The instance of . + /// The operation request. + /// The operation response. + /// The finalStateVia of the operation. + /// If should skip Api version override. + /// The Api version override value. internal AttestationArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); - if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + IOperation nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationImplementation) { - _nextLinkOperation = nextLinkOperationValue; + _nextLinkOperation = nextLinkOperationImplementation; _operationId = _nextLinkOperation.OperationId; } else @@ -49,48 +58,49 @@ internal AttestationArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeli _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); _operationId = GetOperationId(_completeRehydrationToken); } - _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "AttestationArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + nextLinkOperation, + clientDiagnostics, + response, + "AttestationArmOperation", + null, + new SequentialDelayStrategy()); } + /// Gets the Id. + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// Gets the HasCompleted. + public override bool HasCompleted => _operation.HasCompleted; + + /// The token to rehydrate a long-running operation. private string GetOperationId(RehydrationToken? rehydrationToken) { - if (rehydrationToken is null) - { - return null; - } - var data = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerAttestationContext.Default); - using var document = JsonDocument.Parse(data); - var lroDetails = document.RootElement; - return lroDetails.GetProperty("id").GetString(); + return rehydrationToken?.Id; } - /// - public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; - /// + /// public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; - /// - public override bool HasCompleted => _operation.HasCompleted; - - /// + /// public override Response GetRawResponse() => _operation.RawResponse; - /// + /// public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - /// + /// public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - /// + /// public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken); - /// + /// public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken); - /// + /// public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); - /// + /// public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/LongRunningOperation/AttestationArmOperationOfT.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/LongRunningOperation/AttestationArmOperationOfT.cs index 86c9a75c4b17..eb4e38cc121d 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/LongRunningOperation/AttestationArmOperationOfT.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/LongRunningOperation/AttestationArmOperationOfT.cs @@ -6,18 +6,16 @@ #nullable disable using System; -using System.ClientModel.Primitives; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.Attestation { -#pragma warning disable SA1649 // File name should match first type name - internal class AttestationArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class AttestationArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected AttestationArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal AttestationArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); @@ -36,12 +37,21 @@ internal AttestationArmOperation(Response response, RehydrationToken? rehydra _operationId = GetOperationId(rehydrationToken); } + /// + /// The instance of . + /// The instance of . + /// The instance of . + /// The operation request. + /// The operation response. + /// The finalStateVia of the operation. + /// If should skip Api version override. + /// The Api version override value. internal AttestationArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); - if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + IOperation nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationImplementation) { - _nextLinkOperation = nextLinkOperationValue; + _nextLinkOperation = nextLinkOperationImplementation; _operationId = _nextLinkOperation.OperationId; } else @@ -49,54 +59,55 @@ internal AttestationArmOperation(IOperationSource source, ClientDiagnostics c _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); _operationId = GetOperationId(_completeRehydrationToken); } - _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "AttestationArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + NextLinkOperationImplementation.Create(source, nextLinkOperation), + clientDiagnostics, + response, + "AttestationArmOperation", + null, + new SequentialDelayStrategy()); } - private string GetOperationId(RehydrationToken? rehydrationToken) - { - if (rehydrationToken is null) - { - return null; - } - var data = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerAttestationContext.Default); - using var document = JsonDocument.Parse(data); - var lroDetails = document.RootElement; - return lroDetails.GetProperty("id").GetString(); - } - /// + /// Gets the Id. public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; - /// - public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; - - /// + /// Gets the Value. public override T Value => _operation.Value; - /// + /// Gets the HasValue. public override bool HasValue => _operation.HasValue; - /// + /// Gets the HasCompleted. public override bool HasCompleted => _operation.HasCompleted; - /// + /// The token to rehydrate a long-running operation. + private string GetOperationId(RehydrationToken? rehydrationToken) + { + return rehydrationToken?.Id; + } + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// public override Response GetRawResponse() => _operation.RawResponse; - /// + /// public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - /// + /// public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - /// + /// public override Response WaitForCompletion(CancellationToken cancellationToken = default) => _operation.WaitForCompletion(cancellationToken); - /// + /// public override Response WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletion(pollingInterval, cancellationToken); - /// + /// public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); - /// + /// public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationJsonWebKey.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationJsonWebKey.Serialization.cs new file mode 100644 index 000000000000..76f4921a4bec --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationJsonWebKey.Serialization.cs @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Attestation; + +namespace Azure.ResourceManager.Attestation.Models +{ + /// The AttestationJsonWebKey. + public partial class AttestationJsonWebKey : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal AttestationJsonWebKey() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AttestationJsonWebKey)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Alg)) + { + writer.WritePropertyName("alg"u8); + writer.WriteStringValue(Alg); + } + if (Optional.IsDefined(Crv)) + { + writer.WritePropertyName("crv"u8); + writer.WriteStringValue(Crv); + } + if (Optional.IsDefined(D)) + { + writer.WritePropertyName("d"u8); + writer.WriteStringValue(D); + } + if (Optional.IsDefined(Dp)) + { + writer.WritePropertyName("dp"u8); + writer.WriteStringValue(Dp); + } + if (Optional.IsDefined(Dq)) + { + writer.WritePropertyName("dq"u8); + writer.WriteStringValue(Dq); + } + if (Optional.IsDefined(E)) + { + writer.WritePropertyName("e"u8); + writer.WriteStringValue(E); + } + if (Optional.IsDefined(K)) + { + writer.WritePropertyName("k"u8); + writer.WriteStringValue(K); + } + if (Optional.IsDefined(Kid)) + { + writer.WritePropertyName("kid"u8); + writer.WriteStringValue(Kid); + } + writer.WritePropertyName("kty"u8); + writer.WriteStringValue(Kty); + if (Optional.IsDefined(N)) + { + writer.WritePropertyName("n"u8); + writer.WriteStringValue(N); + } + if (Optional.IsDefined(P)) + { + writer.WritePropertyName("p"u8); + writer.WriteStringValue(P); + } + if (Optional.IsDefined(Q)) + { + writer.WritePropertyName("q"u8); + writer.WriteStringValue(Q); + } + if (Optional.IsDefined(Qi)) + { + writer.WritePropertyName("qi"u8); + writer.WriteStringValue(Qi); + } + if (Optional.IsDefined(Use)) + { + writer.WritePropertyName("use"u8); + writer.WriteStringValue(Use); + } + if (Optional.IsDefined(X)) + { + writer.WritePropertyName("x"u8); + writer.WriteStringValue(X); + } + if (Optional.IsCollectionDefined(X5C)) + { + writer.WritePropertyName("x5c"u8); + writer.WriteStartArray(); + foreach (string item in X5C) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Y)) + { + writer.WritePropertyName("y"u8); + writer.WriteStringValue(Y); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + AttestationJsonWebKey IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AttestationJsonWebKey JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AttestationJsonWebKey)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationJsonWebKey(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AttestationJsonWebKey DeserializeAttestationJsonWebKey(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string alg = default; + string crv = default; + string d = default; + string dp = default; + string dq = default; + string e = default; + string k = default; + string kid = default; + string kty = default; + string n = default; + string p = default; + string q = default; + string qi = default; + string use = default; + string x = default; + IList x5C = default; + string y = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("alg"u8)) + { + alg = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("crv"u8)) + { + crv = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("d"u8)) + { + d = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("dp"u8)) + { + dp = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("dq"u8)) + { + dq = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("e"u8)) + { + e = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("k"u8)) + { + k = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("kid"u8)) + { + kid = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("kty"u8)) + { + kty = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("n"u8)) + { + n = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("p"u8)) + { + p = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("q"u8)) + { + q = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("qi"u8)) + { + qi = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("use"u8)) + { + use = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("x"u8)) + { + x = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("x5c"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + x5C = array; + continue; + } + if (prop.NameEquals("y"u8)) + { + y = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new AttestationJsonWebKey( + alg, + crv, + d, + dp, + dq, + e, + k, + kid, + kty, + n, + p, + q, + qi, + use, + x, + x5C ?? new ChangeTrackingList(), + y, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerAttestationContext.Default); + default: + throw new FormatException($"The model {nameof(AttestationJsonWebKey)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + AttestationJsonWebKey IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AttestationJsonWebKey PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeAttestationJsonWebKey(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AttestationJsonWebKey)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKey.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationJsonWebKey.cs similarity index 78% rename from sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKey.cs rename to sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationJsonWebKey.cs index d6904e77c858..47163a53a9d2 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKey.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationJsonWebKey.cs @@ -7,45 +7,17 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { - /// The JsonWebKey. - public partial class JsonWebKey + /// The AttestationJsonWebKey. + public partial class AttestationJsonWebKey { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; - /// Initializes a new instance of . + /// Initializes a new instance of . /// /// The "kty" (key type) parameter identifies the cryptographic algorithm /// family used with the key, such as "RSA" or "EC". "kty" values should @@ -54,7 +26,7 @@ public partial class JsonWebKey /// Resistant Name. The "kty" value is a case-sensitive string. /// /// is null. - public JsonWebKey(string kty) + public AttestationJsonWebKey(string kty) { Argument.AssertNotNull(kty, nameof(kty)); @@ -62,7 +34,7 @@ public JsonWebKey(string kty) X5C = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// /// The "alg" (algorithm) parameter identifies the algorithm intended for /// use with the key. The values used should either be registered in the @@ -115,8 +87,8 @@ public JsonWebKey(string kty) /// certificate. /// /// Y coordinate for the Elliptic Curve point. - /// Keeps track of any properties unknown to the library. - internal JsonWebKey(string alg, string crv, string d, string dp, string dq, string e, string k, string kid, string kty, string n, string p, string q, string qi, string use, string x, IList x5C, string y, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal AttestationJsonWebKey(string alg, string crv, string d, string dp, string dq, string e, string k, string kid, string kty, string n, string p, string q, string qi, string use, string x, IList x5C, string y, IDictionary additionalBinaryDataProperties) { Alg = alg; Crv = crv; @@ -135,12 +107,7 @@ internal JsonWebKey(string alg, string crv, string d, string dp, string dq, stri X = x; X5C = x5C; Y = y; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal JsonWebKey() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// @@ -151,18 +118,25 @@ internal JsonWebKey() /// Resistant Name. /// public string Alg { get; set; } + /// The "crv" (curve) parameter identifies the curve type. public string Crv { get; set; } + /// RSA private exponent or ECC private key. public string D { get; set; } + /// RSA Private Key Parameter. public string Dp { get; set; } + /// RSA Private Key Parameter. public string Dq { get; set; } + /// RSA public exponent, in Base64. public string E { get; set; } + /// Symmetric key. public string K { get; set; } + /// /// The "kid" (key ID) parameter is used to match a specific key. This /// is used, for instance, to choose among a set of keys within a JWK Set @@ -175,6 +149,7 @@ internal JsonWebKey() /// value is a case-sensitive string. /// public string Kid { get; set; } + /// /// The "kty" (key type) parameter identifies the cryptographic algorithm /// family used with the key, such as "RSA" or "EC". "kty" values should @@ -183,14 +158,19 @@ internal JsonWebKey() /// Resistant Name. The "kty" value is a case-sensitive string. /// public string Kty { get; } + /// RSA modulus, in Base64. public string N { get; set; } + /// RSA secret prime. public string P { get; set; } + /// RSA secret prime, with p < q. public string Q { get; set; } + /// RSA Private Key Parameter. public string Qi { get; set; } + /// /// Use ("public key use") identifies the intended use of /// the public key. The "use" parameter is employed to indicate whether @@ -198,8 +178,10 @@ internal JsonWebKey() /// on data. Values are commonly "sig" (signature) or "enc" (encryption). /// public string Use { get; set; } + /// X coordinate for the Elliptic Curve point. public string X { get; set; } + /// /// The "x5c" (X.509 certificate chain) parameter contains a chain of one /// or more PKIX certificates [RFC5280]. The certificate chain is @@ -210,6 +192,7 @@ internal JsonWebKey() /// certificate. /// public IList X5C { get; } + /// Y coordinate for the Elliptic Curve point. public string Y { get; set; } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.Serialization.cs index 861eca879849..47b61a942cbb 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { - internal partial class AttestationPrivateEndpointConnectionListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a PrivateEndpointConnection list operation. + internal partial class AttestationPrivateEndpointConnectionListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal AttestationPrivateEndpointConnectionListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +35,32 @@ void IJsonModel.Write(Utf8JsonWr /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationPrivateEndpointConnectionListResult)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (AttestationPrivateEndpointConnectionData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,58 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AttestationPrivateEndpointConnectionListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AttestationPrivateEndpointConnectionListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AttestationPrivateEndpointConnectionListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationPrivateEndpointConnectionListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAttestationPrivateEndpointConnectionListResult(document.RootElement, options); } - internal static AttestationPrivateEndpointConnectionListResult DeserializeAttestationPrivateEndpointConnectionListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AttestationPrivateEndpointConnectionListResult DeserializeAttestationPrivateEndpointConnectionListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(AttestationPrivateEndpointConnectionData.DeserializeAttestationPrivateEndpointConnectionData(item, options)); } value = array; continue; } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString()); + continue; + } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new AttestationPrivateEndpointConnectionListResult(value ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new AttestationPrivateEndpointConnectionListResult(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -122,15 +142,20 @@ BinaryData IPersistableModel.Wri } } - AttestationPrivateEndpointConnectionListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + AttestationPrivateEndpointConnectionListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AttestationPrivateEndpointConnectionListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeAttestationPrivateEndpointConnectionListResult(document.RootElement, options); } default: @@ -138,6 +163,14 @@ AttestationPrivateEndpointConnectionListResult IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static AttestationPrivateEndpointConnectionListResult FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAttestationPrivateEndpointConnectionListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.cs index d09ddb2427ab..dac4befb013e 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.cs @@ -7,60 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { - /// List of private endpoint connection associated with the specified storage account. + /// The response of a PrivateEndpointConnection list operation. internal partial class AttestationPrivateEndpointConnectionListResult { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal AttestationPrivateEndpointConnectionListResult() + /// The PrivateEndpointConnection items on this page. + internal AttestationPrivateEndpointConnectionListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Array of private endpoint connections. - /// Keeps track of any properties unknown to the library. - internal AttestationPrivateEndpointConnectionListResult(IReadOnlyList value, IDictionary serializedAdditionalRawData) + /// The PrivateEndpointConnection items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal AttestationPrivateEndpointConnectionListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Array of private endpoint connections. - public IReadOnlyList Value { get; } + /// The PrivateEndpointConnection items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionProvisioningState.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionProvisioningState.cs index a2659c50153d..58b7da88ca15 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionProvisioningState.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionProvisioningState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { @@ -14,44 +15,67 @@ namespace Azure.ResourceManager.Attestation.Models public readonly partial struct AttestationPrivateEndpointConnectionProvisioningState : IEquatable { private readonly string _value; + /// Connection has been provisioned. + private const string SucceededValue = "Succeeded"; + /// Connection is being created. + private const string CreatingValue = "Creating"; + /// Connection is being deleted. + private const string DeletingValue = "Deleting"; + /// Connection provisioning has failed. + private const string FailedValue = "Failed"; /// Initializes a new instance of . + /// The value. /// is null. public AttestationPrivateEndpointConnectionProvisioningState(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string SucceededValue = "Succeeded"; - private const string CreatingValue = "Creating"; - private const string DeletingValue = "Deleting"; - private const string FailedValue = "Failed"; + _value = value; + } - /// Succeeded. + /// Connection has been provisioned. public static AttestationPrivateEndpointConnectionProvisioningState Succeeded { get; } = new AttestationPrivateEndpointConnectionProvisioningState(SucceededValue); - /// Creating. + + /// Connection is being created. public static AttestationPrivateEndpointConnectionProvisioningState Creating { get; } = new AttestationPrivateEndpointConnectionProvisioningState(CreatingValue); - /// Deleting. + + /// Connection is being deleted. public static AttestationPrivateEndpointConnectionProvisioningState Deleting { get; } = new AttestationPrivateEndpointConnectionProvisioningState(DeletingValue); - /// Failed. + + /// Connection provisioning has failed. public static AttestationPrivateEndpointConnectionProvisioningState Failed { get; } = new AttestationPrivateEndpointConnectionProvisioningState(FailedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(AttestationPrivateEndpointConnectionProvisioningState left, AttestationPrivateEndpointConnectionProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(AttestationPrivateEndpointConnectionProvisioningState left, AttestationPrivateEndpointConnectionProvisioningState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator AttestationPrivateEndpointConnectionProvisioningState(string value) => new AttestationPrivateEndpointConnectionProvisioningState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator AttestationPrivateEndpointConnectionProvisioningState?(string value) => value == null ? null : new AttestationPrivateEndpointConnectionProvisioningState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is AttestationPrivateEndpointConnectionProvisioningState other && Equals(other); - /// + + /// public bool Equals(AttestationPrivateEndpointConnectionProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointServiceConnectionStatus.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointServiceConnectionStatus.cs index 35e12d5872aa..3b5cc7446c4e 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointServiceConnectionStatus.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointServiceConnectionStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { @@ -14,41 +15,62 @@ namespace Azure.ResourceManager.Attestation.Models public readonly partial struct AttestationPrivateEndpointServiceConnectionStatus : IEquatable { private readonly string _value; + /// Connection waiting for approval or rejection. + private const string PendingValue = "Pending"; + /// Connection approved. + private const string ApprovedValue = "Approved"; + /// Connection Rejected. + private const string RejectedValue = "Rejected"; /// Initializes a new instance of . + /// The value. /// is null. public AttestationPrivateEndpointServiceConnectionStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string PendingValue = "Pending"; - private const string ApprovedValue = "Approved"; - private const string RejectedValue = "Rejected"; + _value = value; + } - /// Pending. + /// Connection waiting for approval or rejection. public static AttestationPrivateEndpointServiceConnectionStatus Pending { get; } = new AttestationPrivateEndpointServiceConnectionStatus(PendingValue); - /// Approved. + + /// Connection approved. public static AttestationPrivateEndpointServiceConnectionStatus Approved { get; } = new AttestationPrivateEndpointServiceConnectionStatus(ApprovedValue); - /// Rejected. + + /// Connection Rejected. public static AttestationPrivateEndpointServiceConnectionStatus Rejected { get; } = new AttestationPrivateEndpointServiceConnectionStatus(RejectedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(AttestationPrivateEndpointServiceConnectionStatus left, AttestationPrivateEndpointServiceConnectionStatus right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(AttestationPrivateEndpointServiceConnectionStatus left, AttestationPrivateEndpointServiceConnectionStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator AttestationPrivateEndpointServiceConnectionStatus(string value) => new AttestationPrivateEndpointServiceConnectionStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator AttestationPrivateEndpointServiceConnectionStatus?(string value) => value == null ? null : new AttestationPrivateEndpointServiceConnectionStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is AttestationPrivateEndpointServiceConnectionStatus other && Equals(other); - /// + + /// public bool Equals(AttestationPrivateEndpointServiceConnectionStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.Serialization.cs index 9f31ba982386..a1376e4cf403 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.Serialization.cs @@ -11,14 +11,16 @@ using System.Text; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Attestation; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Attestation.Models { - public partial class AttestationPrivateLinkResource : IUtf8JsonSerializable, IJsonModel + /// A private link resource. + public partial class AttestationPrivateLinkResource : ResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,164 +32,114 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationPrivateLinkResource)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(GroupId)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("groupId"u8); - writer.WriteStringValue(GroupId); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && Optional.IsCollectionDefined(RequiredMembers)) - { - writer.WritePropertyName("requiredMembers"u8); - writer.WriteStartArray(); - foreach (var item in RequiredMembers) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(RequiredZoneNames)) - { - writer.WritePropertyName("requiredZoneNames"u8); - writer.WriteStartArray(); - foreach (var item in RequiredZoneNames) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); } - AttestationPrivateLinkResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AttestationPrivateLinkResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (AttestationPrivateLinkResource)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationPrivateLinkResource)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAttestationPrivateLinkResource(document.RootElement, options); } - internal static AttestationPrivateLinkResource DeserializeAttestationPrivateLinkResource(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AttestationPrivateLinkResource DeserializeAttestationPrivateLinkResource(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string groupId = default; - IReadOnlyList requiredMembers = default; - IList requiredZoneNames = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AttestationPrivateLinkResourceProperties properties = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (prop.NameEquals("id"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("name"u8)) { - name = property.Value.GetString(); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("type"u8)) { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("systemData"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerAttestationContext.Default); + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerAttestationContext.Default); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("groupId"u8)) - { - groupId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("requiredMembers"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - requiredMembers = array; - continue; - } - if (property0.NameEquals("requiredZoneNames"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - requiredZoneNames = array; - continue; - } - } + properties = AttestationPrivateLinkResourceProperties.DeserializeAttestationPrivateLinkResourceProperties(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new AttestationPrivateLinkResource( id, name, - type, + resourceType, systemData, - groupId, - requiredMembers ?? new ChangeTrackingList(), - requiredZoneNames ?? new ChangeTrackingList(), - serializedAdditionalRawData); + additionalBinaryDataProperties, + properties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -197,15 +149,20 @@ BinaryData IPersistableModel.Write(ModelReaderWr } } - AttestationPrivateLinkResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + AttestationPrivateLinkResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (AttestationPrivateLinkResource)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeAttestationPrivateLinkResource(document.RootElement, options); } default: @@ -213,6 +170,7 @@ AttestationPrivateLinkResource IPersistableModel } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.cs index c9efa34cb66f..320f8a845089 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.cs @@ -15,67 +15,28 @@ namespace Azure.ResourceManager.Attestation.Models /// A private link resource. public partial class AttestationPrivateLinkResource : ResourceData { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - public AttestationPrivateLinkResource() + internal AttestationPrivateLinkResource() { - RequiredMembers = new ChangeTrackingList(); - RequiredZoneNames = new ChangeTrackingList(); } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The private link resource group id. - /// The private link resource required member names. - /// The private link resource Private link DNS zone name. - /// Keeps track of any properties unknown to the library. - internal AttestationPrivateLinkResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource properties. + internal AttestationPrivateLinkResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AttestationPrivateLinkResourceProperties properties) : base(id, name, resourceType, systemData) { - GroupId = groupId; - RequiredMembers = requiredMembers; - RequiredZoneNames = requiredZoneNames; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// The private link resource group id. - public string GroupId { get; } - /// The private link resource required member names. - public IReadOnlyList RequiredMembers { get; } - /// The private link resource Private link DNS zone name. - public IList RequiredZoneNames { get; } + /// Resource properties. + public AttestationPrivateLinkResourceProperties Properties { get; } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.Serialization.cs index 4b35ab69f397..46b46ad9f316 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { - internal partial class AttestationPrivateLinkResourceListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a PrivateLinkResource list operation. + internal partial class AttestationPrivateLinkResourceListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal AttestationPrivateLinkResourceListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter w /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationPrivateLinkResourceListResult)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (AttestationPrivateLinkResource item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,58 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AttestationPrivateLinkResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AttestationPrivateLinkResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AttestationPrivateLinkResourceListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationPrivateLinkResourceListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAttestationPrivateLinkResourceListResult(document.RootElement, options); } - internal static AttestationPrivateLinkResourceListResult DeserializeAttestationPrivateLinkResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AttestationPrivateLinkResourceListResult DeserializeAttestationPrivateLinkResourceListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(AttestationPrivateLinkResource.DeserializeAttestationPrivateLinkResource(item, options)); } value = array; continue; } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString()); + continue; + } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new AttestationPrivateLinkResourceListResult(value ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new AttestationPrivateLinkResourceListResult(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -122,15 +142,20 @@ BinaryData IPersistableModel.Write(Mod } } - AttestationPrivateLinkResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + AttestationPrivateLinkResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AttestationPrivateLinkResourceListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeAttestationPrivateLinkResourceListResult(document.RootElement, options); } default: @@ -138,6 +163,14 @@ AttestationPrivateLinkResourceListResult IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static AttestationPrivateLinkResourceListResult FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAttestationPrivateLinkResourceListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.cs index 45a285bf2ea6..808eee29c065 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.cs @@ -7,60 +7,38 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Attestation.Models { - /// A list of private link resources. + /// The response of a PrivateLinkResource list operation. internal partial class AttestationPrivateLinkResourceListResult { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal AttestationPrivateLinkResourceListResult() + /// The PrivateLinkResource items on this page. + internal AttestationPrivateLinkResourceListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Array of private link resources. - /// Keeps track of any properties unknown to the library. - internal AttestationPrivateLinkResourceListResult(IReadOnlyList value, IDictionary serializedAdditionalRawData) + /// The PrivateLinkResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal AttestationPrivateLinkResourceListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Array of private link resources. - public IReadOnlyList Value { get; } + /// The PrivateLinkResource items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceProperties.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceProperties.Serialization.cs new file mode 100644 index 000000000000..523a40be9567 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceProperties.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Attestation; + +namespace Azure.ResourceManager.Attestation.Models +{ + /// Properties of a private link resource. + public partial class AttestationPrivateLinkResourceProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AttestationPrivateLinkResourceProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(GroupId)) + { + writer.WritePropertyName("groupId"u8); + writer.WriteStringValue(GroupId); + } + if (options.Format != "W" && Optional.IsCollectionDefined(RequiredMembers)) + { + writer.WritePropertyName("requiredMembers"u8); + writer.WriteStartArray(); + foreach (string item in RequiredMembers) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RequiredZoneNames)) + { + writer.WritePropertyName("requiredZoneNames"u8); + writer.WriteStartArray(); + foreach (string item in RequiredZoneNames) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + AttestationPrivateLinkResourceProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AttestationPrivateLinkResourceProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AttestationPrivateLinkResourceProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationPrivateLinkResourceProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AttestationPrivateLinkResourceProperties DeserializeAttestationPrivateLinkResourceProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string groupId = default; + IReadOnlyList requiredMembers = default; + IList requiredZoneNames = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("groupId"u8)) + { + groupId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("requiredMembers"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + requiredMembers = array; + continue; + } + if (prop.NameEquals("requiredZoneNames"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + requiredZoneNames = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new AttestationPrivateLinkResourceProperties(groupId, requiredMembers ?? new ChangeTrackingList(), requiredZoneNames ?? new ChangeTrackingList(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerAttestationContext.Default); + default: + throw new FormatException($"The model {nameof(AttestationPrivateLinkResourceProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + AttestationPrivateLinkResourceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AttestationPrivateLinkResourceProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeAttestationPrivateLinkResourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AttestationPrivateLinkResourceProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceProperties.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceProperties.cs new file mode 100644 index 000000000000..b82a96f17bb5 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceProperties.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Attestation; + +namespace Azure.ResourceManager.Attestation.Models +{ + /// Properties of a private link resource. + public partial class AttestationPrivateLinkResourceProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal AttestationPrivateLinkResourceProperties() + { + RequiredMembers = new ChangeTrackingList(); + RequiredZoneNames = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The private link resource group id. + /// The private link resource required member names. + /// The private link resource private link DNS zone name. + /// Keeps track of any properties unknown to the library. + internal AttestationPrivateLinkResourceProperties(string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, IDictionary additionalBinaryDataProperties) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The private link resource group id. + public string GroupId { get; } + + /// The private link resource required member names. + public IReadOnlyList RequiredMembers { get; } + + /// The private link resource private link DNS zone name. + public IList RequiredZoneNames { get; } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.Serialization.cs index 4ca10bffd4a7..0e24d49dafc1 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { - public partial class AttestationPrivateLinkServiceConnectionState : IUtf8JsonSerializable, IJsonModel + /// A collection of information about the state of the connection between service consumer and provider. + public partial class AttestationPrivateLinkServiceConnectionState : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWrit /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationPrivateLinkServiceConnectionState)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Status)) { writer.WritePropertyName("status"u8); @@ -49,15 +49,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("actionsRequired"u8); writer.WriteStringValue(ActionsRequired); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,22 +66,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AttestationPrivateLinkServiceConnectionState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AttestationPrivateLinkServiceConnectionState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AttestationPrivateLinkServiceConnectionState JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationPrivateLinkServiceConnectionState)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAttestationPrivateLinkServiceConnectionState(document.RootElement, options); } - internal static AttestationPrivateLinkServiceConnectionState DeserializeAttestationPrivateLinkServiceConnectionState(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AttestationPrivateLinkServiceConnectionState DeserializeAttestationPrivateLinkServiceConnectionState(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,42 +94,43 @@ internal static AttestationPrivateLinkServiceConnectionState DeserializeAttestat AttestationPrivateEndpointServiceConnectionStatus? status = default; string description = default; string actionsRequired = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("status"u8)) + if (prop.NameEquals("status"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - status = new AttestationPrivateEndpointServiceConnectionStatus(property.Value.GetString()); + status = new AttestationPrivateEndpointServiceConnectionStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("description"u8)) + if (prop.NameEquals("description"u8)) { - description = property.Value.GetString(); + description = prop.Value.GetString(); continue; } - if (property.NameEquals("actionsRequired"u8)) + if (prop.NameEquals("actionsRequired"u8)) { - actionsRequired = property.Value.GetString(); + actionsRequired = prop.Value.GetString(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new AttestationPrivateLinkServiceConnectionState(status, description, actionsRequired, serializedAdditionalRawData); + return new AttestationPrivateLinkServiceConnectionState(status, description, actionsRequired, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -134,15 +140,20 @@ BinaryData IPersistableModel.Write } } - AttestationPrivateLinkServiceConnectionState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + AttestationPrivateLinkServiceConnectionState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AttestationPrivateLinkServiceConnectionState PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeAttestationPrivateLinkServiceConnectionState(document.RootElement, options); } default: @@ -150,6 +161,7 @@ AttestationPrivateLinkServiceConnectionState IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.cs index 3a39817541cd..6c0af4af049c 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.Attestation.Models /// A collection of information about the state of the connection between service consumer and provider. public partial class AttestationPrivateLinkServiceConnectionState { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public AttestationPrivateLinkServiceConnectionState() @@ -54,19 +25,21 @@ public AttestationPrivateLinkServiceConnectionState() /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. /// The reason for approval/rejection of the connection. /// A message indicating if changes on the service provider require any updates on the consumer. - /// Keeps track of any properties unknown to the library. - internal AttestationPrivateLinkServiceConnectionState(AttestationPrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal AttestationPrivateLinkServiceConnectionState(AttestationPrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired, IDictionary additionalBinaryDataProperties) { Status = status; Description = description; ActionsRequired = actionsRequired; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. public AttestationPrivateEndpointServiceConnectionStatus? Status { get; set; } + /// The reason for approval/rejection of the connection. public string Description { get; set; } + /// A message indicating if changes on the service provider require any updates on the consumer. public string ActionsRequired { get; set; } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.Serialization.cs index 7717672b414f..28dbd0d38dfa 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.Serialization.cs @@ -10,13 +10,20 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { - public partial class AttestationProviderCreateOrUpdateContent : IUtf8JsonSerializable, IJsonModel + /// Parameters for creating an attestation provider. + public partial class AttestationProviderCreateOrUpdateContent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal AttestationProviderCreateOrUpdateContent() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +35,11 @@ void IJsonModel.Write(Utf8JsonWriter w /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationProviderCreateOrUpdateContent)} does not support writing '{format}' format."); } - writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); if (Optional.IsCollectionDefined(Tags)) @@ -43,21 +49,26 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit foreach (var item in Tags) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); } writer.WritePropertyName("properties"u8); writer.WriteObjectValue(Properties, options); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,22 +77,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AttestationProviderCreateOrUpdateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AttestationProviderCreateOrUpdateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AttestationProviderCreateOrUpdateContent JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationProviderCreateOrUpdateContent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAttestationProviderCreateOrUpdateContent(document.RootElement, options); } - internal static AttestationProviderCreateOrUpdateContent DeserializeAttestationProviderCreateOrUpdateContent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AttestationProviderCreateOrUpdateContent DeserializeAttestationProviderCreateOrUpdateContent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,47 +105,55 @@ internal static AttestationProviderCreateOrUpdateContent DeserializeAttestationP AzureLocation location = default; IDictionary tags = default; AttestationServiceCreationSpecificParams properties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("location"u8)) + if (prop.NameEquals("location"u8)) { - location = new AzureLocation(property.Value.GetString()); + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } tags = dictionary; continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("properties"u8)) { - properties = AttestationServiceCreationSpecificParams.DeserializeAttestationServiceCreationSpecificParams(property.Value, options); + properties = AttestationServiceCreationSpecificParams.DeserializeAttestationServiceCreationSpecificParams(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new AttestationProviderCreateOrUpdateContent(location, tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); + return new AttestationProviderCreateOrUpdateContent(location, tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -139,15 +163,20 @@ BinaryData IPersistableModel.Write(Mod } } - AttestationProviderCreateOrUpdateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + AttestationProviderCreateOrUpdateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AttestationProviderCreateOrUpdateContent PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeAttestationProviderCreateOrUpdateContent(document.RootElement, options); } default: @@ -155,6 +184,19 @@ AttestationProviderCreateOrUpdateContent IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(AttestationProviderCreateOrUpdateContent attestationProviderCreateOrUpdateContent) + { + if (attestationProviderCreateOrUpdateContent == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(attestationProviderCreateOrUpdateContent, ModelSerializationExtensions.WireOptions); + return content; + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.cs index ff3a0d8e3d0a..9b66011ed8ca 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.cs @@ -8,43 +8,15 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { /// Parameters for creating an attestation provider. public partial class AttestationProviderCreateOrUpdateContent { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The supported Azure location where the attestation provider should be created. @@ -63,24 +35,21 @@ public AttestationProviderCreateOrUpdateContent(AzureLocation location, Attestat /// The supported Azure location where the attestation provider should be created. /// The tags that will be assigned to the attestation provider. /// Properties of the attestation provider. - /// Keeps track of any properties unknown to the library. - internal AttestationProviderCreateOrUpdateContent(AzureLocation location, IDictionary tags, AttestationServiceCreationSpecificParams properties, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal AttestationProviderCreateOrUpdateContent(AzureLocation location, IDictionary tags, AttestationServiceCreationSpecificParams properties, IDictionary additionalBinaryDataProperties) { Location = location; Tags = tags; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AttestationProviderCreateOrUpdateContent() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The supported Azure location where the attestation provider should be created. public AzureLocation Location { get; } + /// The tags that will be assigned to the attestation provider. public IDictionary Tags { get; } + /// Properties of the attestation provider. public AttestationServiceCreationSpecificParams Properties { get; } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.Serialization.cs index 7fa78e0681e3..be54d8bf6388 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.Serialization.cs @@ -10,15 +10,17 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.Attestation; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Attestation.Models { - internal partial class AttestationProviderListResult : IUtf8JsonSerializable, IJsonModel + /// Attestation Providers List. + internal partial class AttestationProviderListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,12 +32,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationProviderListResult)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(SystemData)) { writer.WritePropertyName("systemData"u8); @@ -45,21 +46,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (AttestationProviderData item in Value) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -68,49 +69,53 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AttestationProviderListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AttestationProviderListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AttestationProviderListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationProviderListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAttestationProviderListResult(document.RootElement, options); } - internal static AttestationProviderListResult DeserializeAttestationProviderListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AttestationProviderListResult DeserializeAttestationProviderListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } SystemData systemData = default; - IReadOnlyList value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("systemData"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerAttestationContext.Default); + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerAttestationContext.Default); continue; } - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(AttestationProviderData.DeserializeAttestationProviderData(item, options)); } @@ -119,17 +124,19 @@ internal static AttestationProviderListResult DeserializeAttestationProviderList } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new AttestationProviderListResult(systemData, value ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new AttestationProviderListResult(systemData, value ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -139,15 +146,20 @@ BinaryData IPersistableModel.Write(ModelReaderWri } } - AttestationProviderListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + AttestationProviderListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AttestationProviderListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeAttestationProviderListResult(document.RootElement, options); } default: @@ -155,6 +167,14 @@ AttestationProviderListResult IPersistableModel.C } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static AttestationProviderListResult FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAttestationProviderListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.cs index 328d69d93dab..20786a153c70 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.Attestation; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Attestation.Models @@ -14,37 +15,8 @@ namespace Azure.ResourceManager.Attestation.Models /// Attestation Providers List. internal partial class AttestationProviderListResult { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal AttestationProviderListResult() @@ -55,17 +27,18 @@ internal AttestationProviderListResult() /// Initializes a new instance of . /// The system metadata relating to this resource. /// Attestation Provider array. - /// Keeps track of any properties unknown to the library. - internal AttestationProviderListResult(SystemData systemData, IReadOnlyList value, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal AttestationProviderListResult(SystemData systemData, IList value, IDictionary additionalBinaryDataProperties) { SystemData = systemData; Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The system metadata relating to this resource. public SystemData SystemData { get; } + /// Attestation Provider array. - public IReadOnlyList Value { get; } + public IList Value { get; } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.Serialization.cs index 42927befa155..8c57a459ea3d 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.Serialization.cs @@ -10,13 +10,15 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { - public partial class AttestationProviderPatch : IUtf8JsonSerializable, IJsonModel + /// Parameters for patching an attestation provider. + public partial class AttestationProviderPatch : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +30,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationProviderPatch)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -41,6 +42,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit foreach (var item in Tags) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); @@ -50,15 +56,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("properties"u8); writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -67,68 +73,81 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AttestationProviderPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AttestationProviderPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AttestationProviderPatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationProviderPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAttestationProviderPatch(document.RootElement, options); } - internal static AttestationProviderPatch DeserializeAttestationProviderPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AttestationProviderPatch DeserializeAttestationProviderPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = default; - AttestationServicePatchSpecificParams properties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + AttestationProviderPatchProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } tags = dictionary; continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = AttestationServicePatchSpecificParams.DeserializeAttestationServicePatchSpecificParams(property.Value, options); + properties = AttestationProviderPatchProperties.DeserializeAttestationProviderPatchProperties(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new AttestationProviderPatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); + return new AttestationProviderPatch(tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -138,15 +157,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp } } - AttestationProviderPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + AttestationProviderPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AttestationProviderPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeAttestationProviderPatch(document.RootElement, options); } default: @@ -154,6 +178,19 @@ AttestationProviderPatch IPersistableModel.Create(Bina } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(AttestationProviderPatch attestationProviderPatch) + { + if (attestationProviderPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(attestationProviderPatch, ModelSerializationExtensions.WireOptions); + return content; + } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.cs index 2d0eff7aa080..d3d0d04607f4 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { /// Parameters for patching an attestation provider. public partial class AttestationProviderPatch { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public AttestationProviderPatch() @@ -54,28 +26,18 @@ public AttestationProviderPatch() /// Initializes a new instance of . /// The tags that will be assigned to the attestation provider. /// Properties of the attestation provider. - /// Keeps track of any properties unknown to the library. - internal AttestationProviderPatch(IDictionary tags, AttestationServicePatchSpecificParams properties, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal AttestationProviderPatch(IDictionary tags, AttestationProviderPatchProperties properties, IDictionary additionalBinaryDataProperties) { Tags = tags; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The tags that will be assigned to the attestation provider. public IDictionary Tags { get; } + /// Properties of the attestation provider. - internal AttestationServicePatchSpecificParams Properties { get; set; } - /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. - public PublicNetworkAccessType? AttestationServicePatchSpecificParamsPublicNetworkAccess - { - get => Properties is null ? default : Properties.PublicNetworkAccess; - set - { - if (Properties is null) - Properties = new AttestationServicePatchSpecificParams(); - Properties.PublicNetworkAccess = value; - } - } + public AttestationProviderPatchProperties Properties { get; set; } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatchProperties.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatchProperties.Serialization.cs new file mode 100644 index 000000000000..f73fe3d1397c --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatchProperties.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Attestation; + +namespace Azure.ResourceManager.Attestation.Models +{ + /// Client supplied parameters used to patch an existing attestation provider. + public partial class AttestationProviderPatchProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AttestationProviderPatchProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } + if (Optional.IsDefined(TpmAttestationAuthentication)) + { + writer.WritePropertyName("tpmAttestationAuthentication"u8); + writer.WriteStringValue(TpmAttestationAuthentication.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + AttestationProviderPatchProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AttestationProviderPatchProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AttestationProviderPatchProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAttestationProviderPatchProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AttestationProviderPatchProperties DeserializeAttestationProviderPatchProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AttestationPublicNetworkAccessType? publicNetworkAccess = default; + TpmAttestationAuthenticationType? tpmAttestationAuthentication = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("publicNetworkAccess"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new AttestationPublicNetworkAccessType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("tpmAttestationAuthentication"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tpmAttestationAuthentication = new TpmAttestationAuthenticationType(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new AttestationProviderPatchProperties(publicNetworkAccess, tpmAttestationAuthentication, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerAttestationContext.Default); + default: + throw new FormatException($"The model {nameof(AttestationProviderPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + AttestationProviderPatchProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AttestationProviderPatchProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeAttestationProviderPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AttestationProviderPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatchProperties.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatchProperties.cs new file mode 100644 index 000000000000..7e007c8f9c78 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatchProperties.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Attestation.Models +{ + /// Client supplied parameters used to patch an existing attestation provider. + public partial class AttestationProviderPatchProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public AttestationProviderPatchProperties() + { + } + + /// Initializes a new instance of . + /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. + /// The setting that controls whether authentication is enabled or disabled for TPM Attestation REST APIs. + /// Keeps track of any properties unknown to the library. + internal AttestationProviderPatchProperties(AttestationPublicNetworkAccessType? publicNetworkAccess, TpmAttestationAuthenticationType? tpmAttestationAuthentication, IDictionary additionalBinaryDataProperties) + { + PublicNetworkAccess = publicNetworkAccess; + TpmAttestationAuthentication = tpmAttestationAuthentication; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. + public AttestationPublicNetworkAccessType? PublicNetworkAccess { get; set; } + + /// The setting that controls whether authentication is enabled or disabled for TPM Attestation REST APIs. + public TpmAttestationAuthenticationType? TpmAttestationAuthentication { get; set; } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPublicNetworkAccessType.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPublicNetworkAccessType.cs new file mode 100644 index 000000000000..002da486cb18 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPublicNetworkAccessType.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.Attestation; + +namespace Azure.ResourceManager.Attestation.Models +{ + /// The public network access type for API calls to the Attestation Provider. + public readonly partial struct AttestationPublicNetworkAccessType : IEquatable + { + private readonly string _value; + /// Enables public network connectivity to the Attestation Provider REST APIs. + private const string EnabledValue = "Enabled"; + /// Disables public network connectivity to the Attestation Provider REST APIs. + private const string DisabledValue = "Disabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public AttestationPublicNetworkAccessType(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Enables public network connectivity to the Attestation Provider REST APIs. + public static AttestationPublicNetworkAccessType Enabled { get; } = new AttestationPublicNetworkAccessType(EnabledValue); + + /// Disables public network connectivity to the Attestation Provider REST APIs. + public static AttestationPublicNetworkAccessType Disabled { get; } = new AttestationPublicNetworkAccessType(DisabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(AttestationPublicNetworkAccessType left, AttestationPublicNetworkAccessType right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(AttestationPublicNetworkAccessType left, AttestationPublicNetworkAccessType right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator AttestationPublicNetworkAccessType(string value) => new AttestationPublicNetworkAccessType(value); + + /// Converts a string to a . + /// The value. + public static implicit operator AttestationPublicNetworkAccessType?(string value) => value == null ? null : new AttestationPublicNetworkAccessType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AttestationPublicNetworkAccessType other && Equals(other); + + /// + public bool Equals(AttestationPublicNetworkAccessType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.Serialization.cs index d8f52c20aa8b..34733a06c705 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { - public partial class AttestationServiceCreationSpecificParams : IUtf8JsonSerializable, IJsonModel + /// Client supplied parameters used to create a new attestation provider. + public partial class AttestationServiceCreationSpecificParams : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter w /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationServiceCreationSpecificParams)} does not support writing '{format}' format."); } - if (Optional.IsDefined(PublicNetworkAccess)) { writer.WritePropertyName("publicNetworkAccess"u8); @@ -44,15 +44,20 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("policySigningCertificates"u8); writer.WriteObjectValue(PolicySigningCertificates, options); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (Optional.IsDefined(TpmAttestationAuthentication)) { - foreach (var item in _serializedAdditionalRawData) + writer.WritePropertyName("tpmAttestationAuthentication"u8); + writer.WriteStringValue(TpmAttestationAuthentication.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,63 +66,79 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AttestationServiceCreationSpecificParams IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AttestationServiceCreationSpecificParams IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AttestationServiceCreationSpecificParams JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AttestationServiceCreationSpecificParams)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAttestationServiceCreationSpecificParams(document.RootElement, options); } - internal static AttestationServiceCreationSpecificParams DeserializeAttestationServiceCreationSpecificParams(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AttestationServiceCreationSpecificParams DeserializeAttestationServiceCreationSpecificParams(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - PublicNetworkAccessType? publicNetworkAccess = default; + AttestationPublicNetworkAccessType? publicNetworkAccess = default; JsonWebKeySet policySigningCertificates = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + TpmAttestationAuthenticationType? tpmAttestationAuthentication = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("publicNetworkAccess"u8)) + if (prop.NameEquals("publicNetworkAccess"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - publicNetworkAccess = new PublicNetworkAccessType(property.Value.GetString()); + publicNetworkAccess = new AttestationPublicNetworkAccessType(prop.Value.GetString()); continue; } - if (property.NameEquals("policySigningCertificates"u8)) + if (prop.NameEquals("policySigningCertificates"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - policySigningCertificates = JsonWebKeySet.DeserializeJsonWebKeySet(property.Value, options); + policySigningCertificates = JsonWebKeySet.DeserializeJsonWebKeySet(prop.Value, options); + continue; + } + if (prop.NameEquals("tpmAttestationAuthentication"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tpmAttestationAuthentication = new TpmAttestationAuthenticationType(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new AttestationServiceCreationSpecificParams(publicNetworkAccess, policySigningCertificates, serializedAdditionalRawData); + return new AttestationServiceCreationSpecificParams(publicNetworkAccess, policySigningCertificates, tpmAttestationAuthentication, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -127,15 +148,20 @@ BinaryData IPersistableModel.Write(Mod } } - AttestationServiceCreationSpecificParams IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + AttestationServiceCreationSpecificParams IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AttestationServiceCreationSpecificParams PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeAttestationServiceCreationSpecificParams(document.RootElement, options); } default: @@ -143,6 +169,7 @@ AttestationServiceCreationSpecificParams IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.cs index b940cfbe0c7e..162f7a500f50 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.Attestation.Models /// Client supplied parameters used to create a new attestation provider. public partial class AttestationServiceCreationSpecificParams { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public AttestationServiceCreationSpecificParams() @@ -53,18 +24,25 @@ public AttestationServiceCreationSpecificParams() /// Initializes a new instance of . /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. /// JSON Web Key Set defining a set of X.509 Certificates that will represent the parent certificate for the signing certificate used for policy operations. - /// Keeps track of any properties unknown to the library. - internal AttestationServiceCreationSpecificParams(PublicNetworkAccessType? publicNetworkAccess, JsonWebKeySet policySigningCertificates, IDictionary serializedAdditionalRawData) + /// The setting that controls whether authentication is enabled or disabled for TPM Attestation REST APIs. + /// Keeps track of any properties unknown to the library. + internal AttestationServiceCreationSpecificParams(AttestationPublicNetworkAccessType? publicNetworkAccess, JsonWebKeySet policySigningCertificates, TpmAttestationAuthenticationType? tpmAttestationAuthentication, IDictionary additionalBinaryDataProperties) { PublicNetworkAccess = publicNetworkAccess; PolicySigningCertificates = policySigningCertificates; - _serializedAdditionalRawData = serializedAdditionalRawData; + TpmAttestationAuthentication = tpmAttestationAuthentication; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. - public PublicNetworkAccessType? PublicNetworkAccess { get; set; } + public AttestationPublicNetworkAccessType? PublicNetworkAccess { get; set; } + /// JSON Web Key Set defining a set of X.509 Certificates that will represent the parent certificate for the signing certificate used for policy operations. internal JsonWebKeySet PolicySigningCertificates { get; set; } + + /// The setting that controls whether authentication is enabled or disabled for TPM Attestation REST APIs. + public TpmAttestationAuthenticationType? TpmAttestationAuthentication { get; set; } + /// /// The value of the "keys" parameter is an array of JWK values. By /// default, the order of the JWK values within the array does not imply @@ -72,12 +50,14 @@ internal AttestationServiceCreationSpecificParams(PublicNetworkAccessType? publi /// can choose to assign a meaning to the order for their purposes, if /// desired. /// - public IList PolicySigningCertificatesKeys + public IList PolicySigningCertificatesKeys { get { if (PolicySigningCertificates is null) + { PolicySigningCertificates = new JsonWebKeySet(); + } return PolicySigningCertificates.Keys; } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServicePatchSpecificParams.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServicePatchSpecificParams.Serialization.cs deleted file mode 100644 index 162b795ef086..000000000000 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServicePatchSpecificParams.Serialization.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Attestation.Models -{ - internal partial class AttestationServicePatchSpecificParams : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AttestationServicePatchSpecificParams)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(PublicNetworkAccess)) - { - writer.WritePropertyName("publicNetworkAccess"u8); - writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AttestationServicePatchSpecificParams IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(AttestationServicePatchSpecificParams)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAttestationServicePatchSpecificParams(document.RootElement, options); - } - - internal static AttestationServicePatchSpecificParams DeserializeAttestationServicePatchSpecificParams(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - PublicNetworkAccessType? publicNetworkAccess = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("publicNetworkAccess"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - publicNetworkAccess = new PublicNetworkAccessType(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AttestationServicePatchSpecificParams(publicNetworkAccess, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerAttestationContext.Default); - default: - throw new FormatException($"The model {nameof(AttestationServicePatchSpecificParams)} does not support writing '{options.Format}' format."); - } - } - - AttestationServicePatchSpecificParams IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAttestationServicePatchSpecificParams(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AttestationServicePatchSpecificParams)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServicePatchSpecificParams.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServicePatchSpecificParams.cs deleted file mode 100644 index 48397d01b653..000000000000 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServicePatchSpecificParams.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.Attestation.Models -{ - /// Client supplied parameters used to patch an existing attestation provider. - internal partial class AttestationServicePatchSpecificParams - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public AttestationServicePatchSpecificParams() - { - } - - /// Initializes a new instance of . - /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. - /// Keeps track of any properties unknown to the library. - internal AttestationServicePatchSpecificParams(PublicNetworkAccessType? publicNetworkAccess, IDictionary serializedAdditionalRawData) - { - PublicNetworkAccess = publicNetworkAccess; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. - public PublicNetworkAccessType? PublicNetworkAccess { get; set; } - } -} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceStatus.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceStatus.cs index a50d75178d00..4769d5fd7b80 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceStatus.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { @@ -14,41 +15,59 @@ namespace Azure.ResourceManager.Attestation.Models public readonly partial struct AttestationServiceStatus : IEquatable { private readonly string _value; + private const string ReadyValue = "Ready"; + private const string NotReadyValue = "NotReady"; + private const string ErrorValue = "Error"; /// Initializes a new instance of . + /// The value. /// is null. public AttestationServiceStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string ReadyValue = "Ready"; - private const string NotReadyValue = "NotReady"; - private const string ErrorValue = "Error"; + _value = value; + } - /// Ready. + /// Gets the Ready. public static AttestationServiceStatus Ready { get; } = new AttestationServiceStatus(ReadyValue); - /// NotReady. + + /// Gets the NotReady. public static AttestationServiceStatus NotReady { get; } = new AttestationServiceStatus(NotReadyValue); - /// Error. + + /// Gets the Error. public static AttestationServiceStatus Error { get; } = new AttestationServiceStatus(ErrorValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(AttestationServiceStatus left, AttestationServiceStatus right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(AttestationServiceStatus left, AttestationServiceStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator AttestationServiceStatus(string value) => new AttestationServiceStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator AttestationServiceStatus?(string value) => value == null ? null : new AttestationServiceStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is AttestationServiceStatus other && Equals(other); - /// + + /// public bool Equals(AttestationServiceStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AzureResourceManagerAttestationContext.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AzureResourceManagerAttestationContext.cs index bfe7d7981e3e..dfbcead179c3 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AzureResourceManagerAttestationContext.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AzureResourceManagerAttestationContext.cs @@ -13,24 +13,27 @@ namespace Azure.ResourceManager.Attestation { /// /// Context class which will be filled in by the System.ClientModel.SourceGeneration. - /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' + /// For more information /// + [ModelReaderWriterBuildable(typeof(AttestationJsonWebKey))] [ModelReaderWriterBuildable(typeof(AttestationPrivateEndpointConnectionData))] [ModelReaderWriterBuildable(typeof(AttestationPrivateEndpointConnectionListResult))] [ModelReaderWriterBuildable(typeof(AttestationPrivateEndpointConnectionResource))] [ModelReaderWriterBuildable(typeof(AttestationPrivateLinkResource))] [ModelReaderWriterBuildable(typeof(AttestationPrivateLinkResourceListResult))] + [ModelReaderWriterBuildable(typeof(AttestationPrivateLinkResourceProperties))] [ModelReaderWriterBuildable(typeof(AttestationPrivateLinkServiceConnectionState))] [ModelReaderWriterBuildable(typeof(AttestationProviderCreateOrUpdateContent))] [ModelReaderWriterBuildable(typeof(AttestationProviderData))] [ModelReaderWriterBuildable(typeof(AttestationProviderListResult))] [ModelReaderWriterBuildable(typeof(AttestationProviderPatch))] + [ModelReaderWriterBuildable(typeof(AttestationProviderPatchProperties))] [ModelReaderWriterBuildable(typeof(AttestationProviderResource))] [ModelReaderWriterBuildable(typeof(AttestationServiceCreationSpecificParams))] - [ModelReaderWriterBuildable(typeof(AttestationServicePatchSpecificParams))] - [ModelReaderWriterBuildable(typeof(JsonWebKey))] [ModelReaderWriterBuildable(typeof(JsonWebKeySet))] [ModelReaderWriterBuildable(typeof(PrivateEndpoint))] + [ModelReaderWriterBuildable(typeof(PrivateEndpointConnectionProperties))] + [ModelReaderWriterBuildable(typeof(StatusResult))] [ModelReaderWriterBuildable(typeof(SystemData))] public partial class AzureResourceManagerAttestationContext : ModelReaderWriterContext { diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKey.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKey.Serialization.cs deleted file mode 100644 index 3ac74ee4d04b..000000000000 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKey.Serialization.cs +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Attestation.Models -{ - public partial class JsonWebKey : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(JsonWebKey)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Alg)) - { - writer.WritePropertyName("alg"u8); - writer.WriteStringValue(Alg); - } - if (Optional.IsDefined(Crv)) - { - writer.WritePropertyName("crv"u8); - writer.WriteStringValue(Crv); - } - if (Optional.IsDefined(D)) - { - writer.WritePropertyName("d"u8); - writer.WriteStringValue(D); - } - if (Optional.IsDefined(Dp)) - { - writer.WritePropertyName("dp"u8); - writer.WriteStringValue(Dp); - } - if (Optional.IsDefined(Dq)) - { - writer.WritePropertyName("dq"u8); - writer.WriteStringValue(Dq); - } - if (Optional.IsDefined(E)) - { - writer.WritePropertyName("e"u8); - writer.WriteStringValue(E); - } - if (Optional.IsDefined(K)) - { - writer.WritePropertyName("k"u8); - writer.WriteStringValue(K); - } - if (Optional.IsDefined(Kid)) - { - writer.WritePropertyName("kid"u8); - writer.WriteStringValue(Kid); - } - writer.WritePropertyName("kty"u8); - writer.WriteStringValue(Kty); - if (Optional.IsDefined(N)) - { - writer.WritePropertyName("n"u8); - writer.WriteStringValue(N); - } - if (Optional.IsDefined(P)) - { - writer.WritePropertyName("p"u8); - writer.WriteStringValue(P); - } - if (Optional.IsDefined(Q)) - { - writer.WritePropertyName("q"u8); - writer.WriteStringValue(Q); - } - if (Optional.IsDefined(Qi)) - { - writer.WritePropertyName("qi"u8); - writer.WriteStringValue(Qi); - } - if (Optional.IsDefined(Use)) - { - writer.WritePropertyName("use"u8); - writer.WriteStringValue(Use); - } - if (Optional.IsDefined(X)) - { - writer.WritePropertyName("x"u8); - writer.WriteStringValue(X); - } - if (Optional.IsCollectionDefined(X5C)) - { - writer.WritePropertyName("x5c"u8); - writer.WriteStartArray(); - foreach (var item in X5C) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(Y)) - { - writer.WritePropertyName("y"u8); - writer.WriteStringValue(Y); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - JsonWebKey IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(JsonWebKey)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeJsonWebKey(document.RootElement, options); - } - - internal static JsonWebKey DeserializeJsonWebKey(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string alg = default; - string crv = default; - string d = default; - string dp = default; - string dq = default; - string e = default; - string k = default; - string kid = default; - string kty = default; - string n = default; - string p = default; - string q = default; - string qi = default; - string use = default; - string x = default; - IList x5c = default; - string y = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("alg"u8)) - { - alg = property.Value.GetString(); - continue; - } - if (property.NameEquals("crv"u8)) - { - crv = property.Value.GetString(); - continue; - } - if (property.NameEquals("d"u8)) - { - d = property.Value.GetString(); - continue; - } - if (property.NameEquals("dp"u8)) - { - dp = property.Value.GetString(); - continue; - } - if (property.NameEquals("dq"u8)) - { - dq = property.Value.GetString(); - continue; - } - if (property.NameEquals("e"u8)) - { - e = property.Value.GetString(); - continue; - } - if (property.NameEquals("k"u8)) - { - k = property.Value.GetString(); - continue; - } - if (property.NameEquals("kid"u8)) - { - kid = property.Value.GetString(); - continue; - } - if (property.NameEquals("kty"u8)) - { - kty = property.Value.GetString(); - continue; - } - if (property.NameEquals("n"u8)) - { - n = property.Value.GetString(); - continue; - } - if (property.NameEquals("p"u8)) - { - p = property.Value.GetString(); - continue; - } - if (property.NameEquals("q"u8)) - { - q = property.Value.GetString(); - continue; - } - if (property.NameEquals("qi"u8)) - { - qi = property.Value.GetString(); - continue; - } - if (property.NameEquals("use"u8)) - { - use = property.Value.GetString(); - continue; - } - if (property.NameEquals("x"u8)) - { - x = property.Value.GetString(); - continue; - } - if (property.NameEquals("x5c"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - x5c = array; - continue; - } - if (property.NameEquals("y"u8)) - { - y = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new JsonWebKey( - alg, - crv, - d, - dp, - dq, - e, - k, - kid, - kty, - n, - p, - q, - qi, - use, - x, - x5c ?? new ChangeTrackingList(), - y, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerAttestationContext.Default); - default: - throw new FormatException($"The model {nameof(JsonWebKey)} does not support writing '{options.Format}' format."); - } - } - - JsonWebKey IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeJsonWebKey(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(JsonWebKey)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.Serialization.cs index 6279b516ca46..e5042c74ebdd 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { - internal partial class JsonWebKeySet : IUtf8JsonSerializable, IJsonModel + /// The JsonWebKeySet. + internal partial class JsonWebKeySet : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +29,30 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(JsonWebKeySet)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Keys)) { writer.WritePropertyName("keys"u8); writer.WriteStartArray(); - foreach (var item in Keys) + foreach (AttestationJsonWebKey item in Keys) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,58 +61,64 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - JsonWebKeySet IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + JsonWebKeySet IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual JsonWebKeySet JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(JsonWebKeySet)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeJsonWebKeySet(document.RootElement, options); } - internal static JsonWebKeySet DeserializeJsonWebKeySet(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static JsonWebKeySet DeserializeJsonWebKeySet(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IList keys = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList keys = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("keys"u8)) + if (prop.NameEquals("keys"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(JsonWebKey.DeserializeJsonWebKey(item, options)); + array.Add(AttestationJsonWebKey.DeserializeAttestationJsonWebKey(item, options)); } keys = array; continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new JsonWebKeySet(keys ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new JsonWebKeySet(keys ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -122,15 +128,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions optio } } - JsonWebKeySet IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + JsonWebKeySet IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual JsonWebKeySet PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeJsonWebKeySet(document.RootElement, options); } default: @@ -138,6 +149,7 @@ JsonWebKeySet IPersistableModel.Create(BinaryData data, ModelRead } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.cs index 3da6833ed300..99ff6e6d5cfc 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.cs @@ -7,48 +7,20 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { /// The JsonWebKeySet. internal partial class JsonWebKeySet { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public JsonWebKeySet() { - Keys = new ChangeTrackingList(); + Keys = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -59,11 +31,11 @@ public JsonWebKeySet() /// can choose to assign a meaning to the order for their purposes, if /// desired. /// - /// Keeps track of any properties unknown to the library. - internal JsonWebKeySet(IList keys, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal JsonWebKeySet(IList keys, IDictionary additionalBinaryDataProperties) { Keys = keys; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// @@ -73,6 +45,6 @@ internal JsonWebKeySet(IList keys, IDictionary s /// can choose to assign a meaning to the order for their purposes, if /// desired. /// - public IList Keys { get; } + public IList Keys { get; } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpoint.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpoint.Serialization.cs index b140c602819d..9beb75713cfe 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpoint.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpoint.Serialization.cs @@ -10,13 +10,15 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Attestation; namespace Azure.ResourceManager.Attestation.Models { - internal partial class PrivateEndpoint : IUtf8JsonSerializable, IJsonModel + /// The private endpoint resource. + internal partial class PrivateEndpoint : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +30,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(PrivateEndpoint)} does not support writing '{format}' format."); } - - if (options.Format != "W" && Optional.IsDefined(StringId)) + if (options.Format != "W" && Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); - writer.WriteStringValue(StringId); + writer.WriteStringValue(Id); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -56,49 +57,59 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - PrivateEndpoint IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + PrivateEndpoint IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PrivateEndpoint JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(PrivateEndpoint)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializePrivateEndpoint(document.RootElement, options); } - internal static PrivateEndpoint DeserializePrivateEndpoint(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PrivateEndpoint DeserializePrivateEndpoint(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - string id = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + ResourceIdentifier id = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (prop.NameEquals("id"u8)) { - id = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new PrivateEndpoint(id, serializedAdditionalRawData); + return new PrivateEndpoint(id, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -108,15 +119,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opt } } - PrivateEndpoint IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + PrivateEndpoint IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PrivateEndpoint PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializePrivateEndpoint(document.RootElement, options); } default: @@ -124,6 +140,7 @@ PrivateEndpoint IPersistableModel.Create(BinaryData data, Model } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpoint.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpoint.cs index 2fabc3b40a51..b8093bab4b33 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpoint.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpoint.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.Core; namespace Azure.ResourceManager.Attestation.Models { - /// The Private Endpoint resource. + /// The private endpoint resource. internal partial class PrivateEndpoint { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public PrivateEndpoint() @@ -51,15 +23,15 @@ public PrivateEndpoint() } /// Initializes a new instance of . - /// The ARM identifier for Private Endpoint. - /// Keeps track of any properties unknown to the library. - internal PrivateEndpoint(string stringId, IDictionary serializedAdditionalRawData) + /// The resource identifier of the private endpoint. + /// Keeps track of any properties unknown to the library. + internal PrivateEndpoint(ResourceIdentifier id, IDictionary additionalBinaryDataProperties) { - StringId = stringId; - _serializedAdditionalRawData = serializedAdditionalRawData; + Id = id; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// The ARM identifier for Private Endpoint. - public string StringId { get; } + /// The resource identifier of the private endpoint. + public ResourceIdentifier Id { get; } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs new file mode 100644 index 000000000000..c1a223d21952 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Attestation; + +namespace Azure.ResourceManager.Attestation.Models +{ + /// Properties of the private endpoint connection. + internal partial class PrivateEndpointConnectionProperties : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal PrivateEndpointConnectionProperties() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(PrivateEndpoint)) + { + writer.WritePropertyName("privateEndpoint"u8); + writer.WriteObjectValue(PrivateEndpoint, options); + } + writer.WritePropertyName("privateLinkServiceConnectionState"u8); + writer.WriteObjectValue(PrivateLinkServiceConnectionState, options); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + PrivateEndpointConnectionProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PrivateEndpointConnectionProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePrivateEndpointConnectionProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PrivateEndpointConnectionProperties DeserializePrivateEndpointConnectionProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PrivateEndpoint privateEndpoint = default; + AttestationPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default; + AttestationPrivateEndpointConnectionProvisioningState? provisioningState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("privateEndpoint"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateEndpoint = PrivateEndpoint.DeserializePrivateEndpoint(prop.Value, options); + continue; + } + if (prop.NameEquals("privateLinkServiceConnectionState"u8)) + { + privateLinkServiceConnectionState = AttestationPrivateLinkServiceConnectionState.DeserializeAttestationPrivateLinkServiceConnectionState(prop.Value, options); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new AttestationPrivateEndpointConnectionProvisioningState(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new PrivateEndpointConnectionProperties(privateEndpoint, privateLinkServiceConnectionState, provisioningState, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerAttestationContext.Default); + default: + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + PrivateEndpointConnectionProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PrivateEndpointConnectionProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializePrivateEndpointConnectionProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpointConnectionProperties.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpointConnectionProperties.cs new file mode 100644 index 000000000000..478929cfe882 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpointConnectionProperties.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Attestation; + +namespace Azure.ResourceManager.Attestation.Models +{ + /// Properties of the private endpoint connection. + internal partial class PrivateEndpointConnectionProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// A collection of information about the state of the connection between service consumer and provider. + /// is null. + public PrivateEndpointConnectionProperties(AttestationPrivateLinkServiceConnectionState privateLinkServiceConnectionState) + { + Argument.AssertNotNull(privateLinkServiceConnectionState, nameof(privateLinkServiceConnectionState)); + + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + } + + /// Initializes a new instance of . + /// The private endpoint resource. + /// A collection of information about the state of the connection between service consumer and provider. + /// The provisioning state of the private endpoint connection resource. + /// Keeps track of any properties unknown to the library. + internal PrivateEndpointConnectionProperties(PrivateEndpoint privateEndpoint, AttestationPrivateLinkServiceConnectionState privateLinkServiceConnectionState, AttestationPrivateEndpointConnectionProvisioningState? provisioningState, IDictionary additionalBinaryDataProperties) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The private endpoint resource. + internal PrivateEndpoint PrivateEndpoint { get; set; } + + /// A collection of information about the state of the connection between service consumer and provider. + public AttestationPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + + /// The provisioning state of the private endpoint connection resource. + public AttestationPrivateEndpointConnectionProvisioningState? ProvisioningState { get; } + + /// The resource identifier of the private endpoint. + public ResourceIdentifier PrivateEndpointId + { + get + { + return PrivateEndpoint is null ? default : PrivateEndpoint.Id; + } + } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PublicNetworkAccessType.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PublicNetworkAccessType.cs deleted file mode 100644 index 39c7b48ffe17..000000000000 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PublicNetworkAccessType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Attestation.Models -{ - /// The public network access type for API calls to the Attestation Provider. - public readonly partial struct PublicNetworkAccessType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public PublicNetworkAccessType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; - - /// Enables public network connectivity to the Attestation Provider REST APIs. - public static PublicNetworkAccessType Enabled { get; } = new PublicNetworkAccessType(EnabledValue); - /// Disables public network connectivity to the Attestation Provider REST APIs. - public static PublicNetworkAccessType Disabled { get; } = new PublicNetworkAccessType(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(PublicNetworkAccessType left, PublicNetworkAccessType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(PublicNetworkAccessType left, PublicNetworkAccessType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator PublicNetworkAccessType(string value) => new PublicNetworkAccessType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is PublicNetworkAccessType other && Equals(other); - /// - public bool Equals(PublicNetworkAccessType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/StatusResult.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/StatusResult.Serialization.cs new file mode 100644 index 000000000000..c34812687397 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/StatusResult.Serialization.cs @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Attestation; + +namespace Azure.ResourceManager.Attestation.Models +{ + /// Status of attestation service. + internal partial class StatusResult : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StatusResult)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(TrustModel)) + { + writer.WritePropertyName("trustModel"u8); + writer.WriteStringValue(TrustModel); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(AttestUri)) + { + writer.WritePropertyName("attestUri"u8); + writer.WriteStringValue(AttestUri.AbsoluteUri); + } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } + if (options.Format != "W" && Optional.IsCollectionDefined(PrivateEndpointConnections)) + { + writer.WritePropertyName("privateEndpointConnections"u8); + writer.WriteStartArray(); + foreach (AttestationPrivateEndpointConnectionData item in PrivateEndpointConnections) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(TpmAttestationAuthentication)) + { + writer.WritePropertyName("tpmAttestationAuthentication"u8); + writer.WriteStringValue(TpmAttestationAuthentication.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + StatusResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StatusResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StatusResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStatusResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StatusResult DeserializeStatusResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string trustModel = default; + AttestationServiceStatus? status = default; + Uri attestUri = default; + AttestationPublicNetworkAccessType? publicNetworkAccess = default; + IReadOnlyList privateEndpointConnections = default; + TpmAttestationAuthenticationType? tpmAttestationAuthentication = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("trustModel"u8)) + { + trustModel = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("status"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new AttestationServiceStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("attestUri"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + attestUri = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("publicNetworkAccess"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new AttestationPublicNetworkAccessType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("privateEndpointConnections"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(AttestationPrivateEndpointConnectionData.DeserializeAttestationPrivateEndpointConnectionData(item, options)); + } + privateEndpointConnections = array; + continue; + } + if (prop.NameEquals("tpmAttestationAuthentication"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tpmAttestationAuthentication = new TpmAttestationAuthenticationType(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new StatusResult( + trustModel, + status, + attestUri, + publicNetworkAccess, + privateEndpointConnections ?? new ChangeTrackingList(), + tpmAttestationAuthentication, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerAttestationContext.Default); + default: + throw new FormatException($"The model {nameof(StatusResult)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + StatusResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StatusResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeStatusResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StatusResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/StatusResult.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/StatusResult.cs new file mode 100644 index 000000000000..56d69b4aeb46 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/StatusResult.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Attestation; + +namespace Azure.ResourceManager.Attestation.Models +{ + /// Status of attestation service. + internal partial class StatusResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public StatusResult() + { + PrivateEndpointConnections = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Trust model for the attestation provider. + /// Status of attestation service. + /// Gets the uri of attestation service. + /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. + /// List of private endpoint connections associated with the attestation provider. + /// The setting that controls whether authentication is enabled or disabled for TPM Attestation REST APIs. + /// Keeps track of any properties unknown to the library. + internal StatusResult(string trustModel, AttestationServiceStatus? status, Uri attestUri, AttestationPublicNetworkAccessType? publicNetworkAccess, IReadOnlyList privateEndpointConnections, TpmAttestationAuthenticationType? tpmAttestationAuthentication, IDictionary additionalBinaryDataProperties) + { + TrustModel = trustModel; + Status = status; + AttestUri = attestUri; + PublicNetworkAccess = publicNetworkAccess; + PrivateEndpointConnections = privateEndpointConnections; + TpmAttestationAuthentication = tpmAttestationAuthentication; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Trust model for the attestation provider. + public string TrustModel { get; set; } + + /// Status of attestation service. + public AttestationServiceStatus? Status { get; set; } + + /// Gets the uri of attestation service. + public Uri AttestUri { get; set; } + + /// Controls whether traffic from the public network is allowed to access the Attestation Provider APIs. + public AttestationPublicNetworkAccessType? PublicNetworkAccess { get; set; } + + /// List of private endpoint connections associated with the attestation provider. + public IReadOnlyList PrivateEndpointConnections { get; } = new ChangeTrackingList(); + + /// The setting that controls whether authentication is enabled or disabled for TPM Attestation REST APIs. + public TpmAttestationAuthenticationType? TpmAttestationAuthentication { get; set; } + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/TpmAttestationAuthenticationType.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/TpmAttestationAuthenticationType.cs new file mode 100644 index 000000000000..52f2b85ee054 --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/TpmAttestationAuthenticationType.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.Attestation; + +namespace Azure.ResourceManager.Attestation.Models +{ + /// The type for specifying the requirement of authentication for TPM Attestation REST APIs. + public readonly partial struct TpmAttestationAuthenticationType : IEquatable + { + private readonly string _value; + /// Enables the requirement of authentication for TPM Attestation REST APIs. + private const string EnabledValue = "Enabled"; + /// Disables the requirement of authentication for TPM Attestation REST APIs. + private const string DisabledValue = "Disabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public TpmAttestationAuthenticationType(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Enables the requirement of authentication for TPM Attestation REST APIs. + public static TpmAttestationAuthenticationType Enabled { get; } = new TpmAttestationAuthenticationType(EnabledValue); + + /// Disables the requirement of authentication for TPM Attestation REST APIs. + public static TpmAttestationAuthenticationType Disabled { get; } = new TpmAttestationAuthenticationType(DisabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(TpmAttestationAuthenticationType left, TpmAttestationAuthenticationType right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(TpmAttestationAuthenticationType left, TpmAttestationAuthenticationType right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator TpmAttestationAuthenticationType(string value) => new TpmAttestationAuthenticationType(value); + + /// Converts a string to a . + /// The value. + public static implicit operator TpmAttestationAuthenticationType?(string value) => value == null ? null : new TpmAttestationAuthenticationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TpmAttestationAuthenticationType other && Equals(other); + + /// + public bool Equals(TpmAttestationAuthenticationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/ProviderConstants.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/ProviderConstants.cs index 9066d64b8b52..f3deb7169e50 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/ProviderConstants.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/ProviderConstants.cs @@ -9,8 +9,9 @@ namespace Azure.ResourceManager.Attestation { - internal static class ProviderConstants + internal static partial class ProviderConstants { + /// Gets the DefaultProviderNamespace. public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/AttestationProvidersRestOperations.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/AttestationProvidersRestOperations.cs index e513ededbb0f..01c4f730c08f 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/AttestationProvidersRestOperations.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/AttestationProvidersRestOperations.cs @@ -6,152 +6,44 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.Attestation.Models; namespace Azure.ResourceManager.Attestation { - internal partial class AttestationProvidersRestOperations + internal partial class AttestationProviders { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of AttestationProvidersRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public AttestationProvidersRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-06-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string providerName) + /// Initializes a new instance of AttestationProviders for mocking. + protected AttestationProviders() { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders/", false); - uri.AppendPath(providerName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string providerName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders/", false); - uri.AppendPath(providerName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; } - /// Get the status of Attestation Provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Name of the attestation provider. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string providerName, CancellationToken cancellationToken = default) + /// Initializes a new instance of AttestationProviders. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal AttestationProviders(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, providerName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AttestationProviderData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AttestationProviderData.DeserializeAttestationProviderData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((AttestationProviderData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// Get the status of Attestation Provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Name of the attestation provider. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string providerName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateGetRequest(subscriptionId, resourceGroupName, providerName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AttestationProviderData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AttestationProviderData.DeserializeAttestationProviderData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((AttestationProviderData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string providerName, AttestationProviderCreateOrUpdateContent content) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string providerName, RequestContext context) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders/", false); - uri.AppendPath(providerName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string providerName, AttestationProviderCreateOrUpdateContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -160,100 +52,17 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders/", false); uri.AppendPath(providerName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Creates a new Attestation Provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Name of the attestation provider. - /// Client supplied parameters. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> CreateAsync(string subscriptionId, string resourceGroupName, string providerName, AttestationProviderCreateOrUpdateContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, providerName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - AttestationProviderData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AttestationProviderData.DeserializeAttestationProviderData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Creates a new Attestation Provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Name of the attestation provider. - /// Client supplied parameters. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string providerName, AttestationProviderCreateOrUpdateContent content, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string providerName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, providerName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - AttestationProviderData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AttestationProviderData.DeserializeAttestationProviderData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string providerName, AttestationProviderPatch patch) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders/", false); - uri.AppendPath(providerName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string providerName, AttestationProviderPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -262,81 +71,19 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders/", false); uri.AppendPath(providerName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Updates the Attestation Provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Name of the attestation provider. - /// Client supplied parameters. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string providerName, AttestationProviderPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, providerName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AttestationProviderData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AttestationProviderData.DeserializeAttestationProviderData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Updates the Attestation Provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Name of the attestation provider. - /// Client supplied parameters. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string providerName, AttestationProviderPatch patch, CancellationToken cancellationToken = default) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string providerName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, providerName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AttestationProviderData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AttestationProviderData.DeserializeAttestationProviderData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string providerName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -345,15 +92,19 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders/", false); uri.AppendPath(providerName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string providerName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string providerName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -362,145 +113,16 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders/", false); uri.AppendPath(providerName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete Attestation Service. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Name of the attestation service. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string providerName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, providerName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete Attestation Service. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Name of the attestation service. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string providerName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, providerName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Delete; return message; } - /// Returns a list of attestation providers in a subscription. - /// The ID of the target subscription. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListRequest(subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AttestationProviderListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AttestationProviderListResult.DeserializeAttestationProviderListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Returns a list of attestation providers in a subscription. - /// The ID of the target subscription. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetByResourceGroupRequest(string subscriptionId, string resourceGroupName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListRequest(subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AttestationProviderListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AttestationProviderListResult.DeserializeAttestationProviderListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -508,242 +130,62 @@ internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscripti uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + internal HttpMessage CreateGetAllRequest(string subscriptionId, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Returns attestation providers list in a resource group. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AttestationProviderListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AttestationProviderListResult.DeserializeAttestationProviderListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Returns attestation providers list in a resource group. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetDefaultAttestationProviderRequest(string subscriptionId, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AttestationProviderListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AttestationProviderListResult.DeserializeAttestationProviderListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListDefaultRequestUri(string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Attestation/defaultProviders", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListDefaultRequest(string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.Attestation/defaultProviders", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get the default provider. - /// The ID of the target subscription. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListDefaultAsync(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListDefaultRequest(subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AttestationProviderListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AttestationProviderListResult.DeserializeAttestationProviderListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the default provider. - /// The ID of the target subscription. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListDefault(string subscriptionId, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetDefaultAttestationProviderByLocationRequest(string subscriptionId, AzureLocation location, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListDefaultRequest(subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AttestationProviderListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AttestationProviderListResult.DeserializeAttestationProviderListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetDefaultByLocationRequestUri(string subscriptionId, AzureLocation location) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Attestation/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/defaultProvider", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetDefaultByLocationRequest(string subscriptionId, AzureLocation location) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.Attestation/locations/", false); - uri.AppendPath(location, true); + uri.AppendPath(location.ToString(), true); uri.AppendPath("/defaultProvider", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// Get the default provider by location. - /// The ID of the target subscription. - /// The location of the default provider. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> GetDefaultByLocationAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateGetDefaultByLocationRequest(subscriptionId, location); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AttestationProviderData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AttestationProviderData.DeserializeAttestationProviderData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the default provider by location. - /// The ID of the target subscription. - /// The location of the default provider. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response GetDefaultByLocation(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateGetDefaultByLocationRequest(subscriptionId, location); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AttestationProviderData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AttestationProviderData.DeserializeAttestationProviderData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 2931ca442104..8b1a2b37653b 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -6,152 +6,44 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.Attestation.Models; namespace Azure.ResourceManager.Attestation { - internal partial class PrivateEndpointConnectionsRestOperations + internal partial class PrivateEndpointConnections { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of PrivateEndpointConnectionsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-06-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string providerName) + /// Initializes a new instance of PrivateEndpointConnections for mocking. + protected PrivateEndpointConnections() { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders/", false); - uri.AppendPath(providerName, true); - uri.AppendPath("/privateEndpointConnections", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string providerName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders/", false); - uri.AppendPath(providerName, true); - uri.AppendPath("/privateEndpointConnections", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List all the private endpoint connections associated with the attestation provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the attestation provider. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string providerName, CancellationToken cancellationToken = default) + /// Initializes a new instance of PrivateEndpointConnections. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal PrivateEndpointConnections(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, providerName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AttestationPrivateEndpointConnectionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AttestationPrivateEndpointConnectionListResult.DeserializeAttestationPrivateEndpointConnectionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List all the private endpoint connections associated with the attestation provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the attestation provider. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string providerName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName, providerName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AttestationPrivateEndpointConnectionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AttestationPrivateEndpointConnectionListResult.DeserializeAttestationPrivateEndpointConnectionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName, RequestContext context) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders/", false); - uri.AppendPath(providerName, true); - uri.AppendPath("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -162,100 +54,17 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Gets the specified private endpoint connection associated with the attestation provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the attestation provider. - /// The name of the private endpoint connection associated with the Azure resource. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, providerName, privateEndpointConnectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AttestationPrivateEndpointConnectionData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AttestationPrivateEndpointConnectionData.DeserializeAttestationPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((AttestationPrivateEndpointConnectionData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the specified private endpoint connection associated with the attestation provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the attestation provider. - /// The name of the private endpoint connection associated with the Azure resource. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, providerName, privateEndpointConnectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AttestationPrivateEndpointConnectionData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AttestationPrivateEndpointConnectionData.DeserializeAttestationPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((AttestationPrivateEndpointConnectionData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName, AttestationPrivateEndpointConnectionData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders/", false); - uri.AppendPath(providerName, true); - uri.AppendPath("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName, AttestationPrivateEndpointConnectionData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -266,85 +75,19 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Update the state of specified private endpoint connection associated with the attestation provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the attestation provider. - /// The name of the private endpoint connection associated with the Azure resource. - /// The private endpoint connection properties. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateAsync(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName, AttestationPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, providerName, privateEndpointConnectionName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AttestationPrivateEndpointConnectionData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AttestationPrivateEndpointConnectionData.DeserializeAttestationPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update the state of specified private endpoint connection associated with the attestation provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the attestation provider. - /// The name of the private endpoint connection associated with the Azure resource. - /// The private endpoint connection properties. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName, AttestationPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, providerName, privateEndpointConnectionName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AttestationPrivateEndpointConnectionData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AttestationPrivateEndpointConnectionData.DeserializeAttestationPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -355,15 +98,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName) + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string providerName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -371,69 +115,27 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders/", false); uri.AppendPath(providerName, true); - uri.AppendPath("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); + uri.AppendPath("/privateEndpointConnections", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Deletes the specified private endpoint connection associated with the attestation provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the attestation provider. - /// The name of the private endpoint connection associated with the Azure resource. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string providerName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, providerName, privateEndpointConnectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Deletes the specified private endpoint connection associated with the attestation provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the attestation provider. - /// The name of the private endpoint connection associated with the Azure resource. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string providerName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, providerName, privateEndpointConnectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs index 00b4b8366619..77003a04453b 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs @@ -6,57 +6,44 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.Attestation.Models; namespace Azure.ResourceManager.Attestation { - internal partial class PrivateLinkResourcesRestOperations + internal partial class PrivateLinkResources { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of PrivateLinkResourcesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public PrivateLinkResourcesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of PrivateLinkResources for mocking. + protected PrivateLinkResources() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-06-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListByProviderRequestUri(string subscriptionId, string resourceGroupName, string providerName) + /// Initializes a new instance of PrivateLinkResources. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal PrivateLinkResources(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Attestation/attestationProviders/", false); - uri.AppendPath(providerName, true); - uri.AppendPath("/privateLinkResources", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateListByProviderRequest(string subscriptionId, string resourceGroupName, string providerName) + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetPrivateLinkResourcesRequest(string subscriptionId, string resourceGroupName, string providerName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -66,68 +53,12 @@ internal HttpMessage CreateListByProviderRequest(string subscriptionId, string r uri.AppendPath(providerName, true); uri.AppendPath("/privateLinkResources", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// Gets the private link resources supported for the attestation provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the attestation provider. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByProviderAsync(string subscriptionId, string resourceGroupName, string providerName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - - using var message = CreateListByProviderRequest(subscriptionId, resourceGroupName, providerName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AttestationPrivateLinkResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AttestationPrivateLinkResourceListResult.DeserializeAttestationPrivateLinkResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the private link resources supported for the attestation provider. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the attestation provider. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByProvider(string subscriptionId, string resourceGroupName, string providerName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - - using var message = CreateListByProviderRequest(subscriptionId, resourceGroupName, providerName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AttestationPrivateLinkResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AttestationPrivateLinkResourceListResult.DeserializeAttestationPrivateLinkResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/autorest.md b/sdk/attestation/Azure.ResourceManager.Attestation/src/autorest.md.bak similarity index 100% rename from sdk/attestation/Azure.ResourceManager.Attestation/src/autorest.md rename to sdk/attestation/Azure.ResourceManager.Attestation/src/autorest.md.bak diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationPrivateEndpointConnectionCollection.cs b/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationPrivateEndpointConnectionCollection.cs index 92764ecd40a0..e112ac69ac80 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationPrivateEndpointConnectionCollection.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationPrivateEndpointConnectionCollection.cs @@ -43,7 +43,7 @@ public async Task CreateOrUpdate_AttestationProviderPutPrivateEndpointConnection string privateEndpointConnectionName = "{privateEndpointConnectionName}"; AttestationPrivateEndpointConnectionData data = new AttestationPrivateEndpointConnectionData { - ConnectionState = new AttestationPrivateLinkServiceConnectionState + PrivateLinkServiceConnectionState = new AttestationPrivateLinkServiceConnectionState { Status = AttestationPrivateEndpointServiceConnectionStatus.Approved, Description = "Auto-Approved", diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationPrivateEndpointConnectionResource.cs b/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationPrivateEndpointConnectionResource.cs index b936ba53f910..1e7b5f16c7d5 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationPrivateEndpointConnectionResource.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationPrivateEndpointConnectionResource.cs @@ -98,7 +98,7 @@ public async Task Update_AttestationProviderPutPrivateEndpointConnection() // invoke the operation AttestationPrivateEndpointConnectionData data = new AttestationPrivateEndpointConnectionData { - ConnectionState = new AttestationPrivateLinkServiceConnectionState + PrivateLinkServiceConnectionState = new AttestationPrivateLinkServiceConnectionState { Status = AttestationPrivateEndpointServiceConnectionStatus.Approved, Description = "Auto-Approved", diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationProviderCollection.cs b/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationProviderCollection.cs index ff7c0818083a..9f881aa14f30 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationProviderCollection.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationProviderCollection.cs @@ -43,7 +43,7 @@ public async Task CreateOrUpdate_AttestationProvidersCreate() string providerName = "myattestationprovider"; AttestationProviderCreateOrUpdateContent content = new AttestationProviderCreateOrUpdateContent(new AzureLocation("East US"), new AttestationServiceCreationSpecificParams { - PublicNetworkAccess = PublicNetworkAccessType.Enabled, + PublicNetworkAccess = AttestationPublicNetworkAccessType.Enabled, }) { Tags = diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationProviderResource.cs b/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationProviderResource.cs index 3bf46d9e0f3c..c9a05906fd69 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationProviderResource.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_AttestationProviderResource.cs @@ -101,7 +101,10 @@ public async Task Update_AttestationProvidersUpdate() ["Property2"] = "Value2", ["Property3"] = "Value3" }, - AttestationServicePatchSpecificParamsPublicNetworkAccess = PublicNetworkAccessType.Disabled, + Properties = new AttestationProviderPatchProperties + { + PublicNetworkAccess = AttestationPublicNetworkAccessType.Disabled, + }, }; AttestationProviderResource result = await attestationProvider.UpdateAsync(patch); @@ -133,7 +136,7 @@ public async Task GetPrivateLinkResourcesByProvider_AttestationProviderListPriva AttestationProviderResource attestationProvider = client.GetAttestationProviderResource(attestationProviderResourceId); // invoke the operation and iterate over the result - await foreach (AttestationPrivateLinkResource item in attestationProvider.GetPrivateLinkResourcesByProviderAsync()) + await foreach (AttestationPrivateLinkResource item in attestationProvider.GetPrivateLinkResourcesAsync()) { Console.WriteLine($"Succeeded: {item}"); } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index 038759246606..9395f66b6a40 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; +using Azure.ResourceManager.Attestation.Models; using Azure.ResourceManager.Resources; using NUnit.Framework; @@ -66,7 +67,7 @@ public async Task GetAttestationProvidersByDefaultProvider_AttestationProvidersG SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (AttestationProviderResource item in subscriptionResource.GetAttestationProvidersByDefaultProviderAsync()) + await foreach (AttestationProviderResource item in subscriptionResource.GetDefaultAttestationProviderAsync()) { // the variable item is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -97,8 +98,8 @@ public async Task GetDefaultByLocationAttestationProvider_AttestationProvidersGe SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation - AzureLocation location = new AzureLocation("Central US"); - AttestationProviderResource result = await subscriptionResource.GetDefaultByLocationAttestationProviderAsync(location); + string location = "Central US"; + AttestationProviderResource result = await subscriptionResource.GetDefaultAttestationProviderByLocationAsync(location); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/tests/Helpers/ResourceDataHelper.cs b/sdk/attestation/Azure.ResourceManager.Attestation/tests/Helpers/ResourceDataHelper.cs index 1f4d5b9337a8..33a954f9c722 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/tests/Helpers/ResourceDataHelper.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/tests/Helpers/ResourceDataHelper.cs @@ -34,7 +34,7 @@ public static AttestationPrivateEndpointConnectionData GetPrivateEndpointConnect { return new AttestationPrivateEndpointConnectionData() { - ConnectionState = new AttestationPrivateLinkServiceConnectionState() + PrivateLinkServiceConnectionState = new AttestationPrivateLinkServiceConnectionState() { Status = AttestationPrivateEndpointServiceConnectionStatus.Approved, Description = "Auto-Approved", @@ -49,7 +49,7 @@ public static void AssetConnectionState(AttestationPrivateLinkServiceConnectionS public static void AssetPrivateEndpointConnection(AttestationPrivateEndpointConnectionData data1, AttestationPrivateEndpointConnectionData data2) { AssertResource(data1, data2); - AssetConnectionState(data1.ConnectionState, data2.ConnectionState); + AssetConnectionState(data1.PrivateLinkServiceConnectionState, data2.PrivateLinkServiceConnectionState); Assert.AreEqual(data1.ProvisioningState, data2.ProvisioningState); } #endregion @@ -59,7 +59,7 @@ public static AttestationProviderCreateOrUpdateContent GetProviderData(AzureLoca { return new AttestationProviderCreateOrUpdateContent(location, new AttestationServiceCreationSpecificParams() { - PublicNetworkAccess = PublicNetworkAccessType.Enabled, + PublicNetworkAccess = AttestationPublicNetworkAccessType.Enabled, }) { Tags = diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/tests/TestCase/AttestationProviderTest.cs b/sdk/attestation/Azure.ResourceManager.Attestation/tests/TestCase/AttestationProviderTest.cs index 794bf3baf7b2..4ec28aa8fd65 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/tests/TestCase/AttestationProviderTest.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/tests/TestCase/AttestationProviderTest.cs @@ -61,7 +61,10 @@ public async Task ProviderApiTest() ["UpdateKey1"] = "UpdateValue1", ["UpdateKey1"] = "UpdateValue1" }, - AttestationServicePatchSpecificParamsPublicNetworkAccess = PublicNetworkAccessType.Disabled + Properties = new AttestationProviderPatchProperties + { + PublicNetworkAccess = AttestationPublicNetworkAccessType.Disabled + } }; var providerResource4 =(await providerResource3.UpdateAsync(patch)).Value; Assert.AreEqual(patch.Tags.Count, providerResource4.Data.Tags.Count); diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/tests/TestCase/PrivateEndpointConnectionTests.cs b/sdk/attestation/Azure.ResourceManager.Attestation/tests/TestCase/PrivateEndpointConnectionTests.cs index 10308734b3ca..9088a31190e4 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/tests/TestCase/PrivateEndpointConnectionTests.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/tests/TestCase/PrivateEndpointConnectionTests.cs @@ -39,11 +39,11 @@ public async Task PrivateEndpointConnectionApiTest() var endpoint = await GetEndpointResource(resourceGroup, providerResource.Data.Id); var endpointCollection = providerResource.GetAttestationPrivateEndpointConnections(); //2.Get - var connections = await endpointCollection.GetAllAsync().ToEnumerableAsync(); - string privateEndpointConnectionName = connections.FirstOrDefault().Data.Name; - var privateEndpointConnectionData = connections.FirstOrDefault().Data; + var connection = await endpointCollection.GetAllAsync().ToEnumerableAsync(); + string privateEndpointConnectionName = connection.FirstOrDefault().Data.Name; + var privateEndpointConnectionData = connection.FirstOrDefault().Data; Assert.NotNull(privateEndpointConnectionData); - Assert.AreEqual("Approved", privateEndpointConnectionData.ConnectionState.Status.ToString()); + Assert.AreEqual("Approved", privateEndpointConnectionData.PrivateLinkServiceConnectionState.Status.ToString()); //3.GetAll var list = await endpointCollection.GetAllAsync().ToEnumerableAsync(); Assert.AreEqual(1, list.Count); diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/tsp-location.yaml b/sdk/attestation/Azure.ResourceManager.Attestation/tsp-location.yaml new file mode 100644 index 000000000000..1bac3311c37a --- /dev/null +++ b/sdk/attestation/Azure.ResourceManager.Attestation/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/attestation/resource-manager/Microsoft.Attestation/Attestation +commit: d449fca585aa25a5a7d6e0739383c14f804c4bc6 +repo: Azure/azure-rest-api-specs +emitterPackageJsonPath: "eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json" diff --git a/sdk/attestation/Azure.Security.Attestation/api/Azure.Security.Attestation.net10.0.cs b/sdk/attestation/Azure.Security.Attestation/api/Azure.Security.Attestation.net10.0.cs new file mode 100644 index 000000000000..c05e109cf5c5 --- /dev/null +++ b/sdk/attestation/Azure.Security.Attestation/api/Azure.Security.Attestation.net10.0.cs @@ -0,0 +1,271 @@ +namespace Azure.Security.Attestation +{ + public partial class AttestationAdministrationClient + { + protected AttestationAdministrationClient() { } + public AttestationAdministrationClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public AttestationAdministrationClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Security.Attestation.AttestationClientOptions options) { } + public System.Uri Endpoint { get { throw null; } } + public virtual Azure.Security.Attestation.AttestationResponse AddPolicyManagementCertificate(System.Security.Cryptography.X509Certificates.X509Certificate2 newSigningCertificate, Azure.Security.Attestation.AttestationTokenSigningKey existingSigningKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddPolicyManagementCertificateAsync(System.Security.Cryptography.X509Certificates.X509Certificate2 newSigningCertificate, Azure.Security.Attestation.AttestationTokenSigningKey existingSigningKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Security.Attestation.AttestationResponse GetPolicy(Azure.Security.Attestation.AttestationType attestationType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPolicyAsync(Azure.Security.Attestation.AttestationType attestationType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Security.Attestation.AttestationResponse> GetPolicyManagementCertificates(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task>> GetPolicyManagementCertificatesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Security.Attestation.AttestationResponse RemovePolicyManagementCertificate(System.Security.Cryptography.X509Certificates.X509Certificate2 certificateToRemove, Azure.Security.Attestation.AttestationTokenSigningKey existingSigningKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemovePolicyManagementCertificateAsync(System.Security.Cryptography.X509Certificates.X509Certificate2 certificateToRemove, Azure.Security.Attestation.AttestationTokenSigningKey existingSigningKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Security.Attestation.AttestationResponse ResetPolicy(Azure.Security.Attestation.AttestationType attestationType, Azure.Security.Attestation.AttestationTokenSigningKey signingKey = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ResetPolicyAsync(Azure.Security.Attestation.AttestationType attestationType, Azure.Security.Attestation.AttestationTokenSigningKey signingKey = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Security.Attestation.AttestationResponse SetPolicy(Azure.Security.Attestation.AttestationType attestationType, string policyToSet, Azure.Security.Attestation.AttestationTokenSigningKey signingKey = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetPolicyAsync(Azure.Security.Attestation.AttestationType attestationType, string policyToSet, Azure.Security.Attestation.AttestationTokenSigningKey signingKey = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class AttestationClient + { + protected AttestationClient() { } + public AttestationClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public AttestationClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Security.Attestation.AttestationClientOptions options) { } + public System.Uri Endpoint { get { throw null; } } + public virtual Azure.Security.Attestation.AttestationResponse AttestOpenEnclave(Azure.Security.Attestation.AttestationRequest request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AttestOpenEnclaveAsync(Azure.Security.Attestation.AttestationRequest request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Security.Attestation.AttestationResponse AttestSgxEnclave(Azure.Security.Attestation.AttestationRequest request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AttestSgxEnclaveAsync(Azure.Security.Attestation.AttestationRequest request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response AttestTpm(Azure.Security.Attestation.TpmAttestationRequest request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AttestTpmAsync(Azure.Security.Attestation.TpmAttestationRequest request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response> GetSigningCertificates(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task>> GetSigningCertificatesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class AttestationClientOptions : Azure.Core.ClientOptions + { + public AttestationClientOptions(Azure.Security.Attestation.AttestationClientOptions.ServiceVersion version = Azure.Security.Attestation.AttestationClientOptions.ServiceVersion.V2020_10_01, Azure.Security.Attestation.AttestationTokenValidationOptions tokenOptions = null) { } + public Azure.Security.Attestation.AttestationTokenValidationOptions TokenOptions { get { throw null; } } + public enum ServiceVersion + { + V2020_10_01 = 1, + } + } + public partial class AttestationData + { + public AttestationData(System.BinaryData data, bool dataIsJson) { } + public System.BinaryData BinaryData { get { throw null; } } + public bool DataIsJson { get { throw null; } } + } + public static partial class AttestationModelFactory + { + public static Azure.Security.Attestation.AttestationResponse AttestationResponse(Azure.Response response, Azure.Security.Attestation.AttestationToken token, T body = null) where T : class { throw null; } + public static Azure.Security.Attestation.AttestationResult AttestationResult(string jti = null, string issuer = null, System.DateTimeOffset issuedAt = default(System.DateTimeOffset), System.DateTimeOffset expiration = default(System.DateTimeOffset), System.DateTimeOffset notBefore = default(System.DateTimeOffset), object cnf = null, string nonce = null, string version = null, object runtimeClaims = null, object inittimeClaims = null, object policyClaims = null, string verifierType = null, Azure.Security.Attestation.AttestationSigner policySigner = null, System.BinaryData policyHash = null, bool? isDebuggable = default(bool?), float? productId = default(float?), string mrEnclave = null, string mrSigner = null, float? svn = default(float?), System.BinaryData enclaveHeldData = null, object sgxCollateral = null, string deprecatedVersion = null, bool? deprecatedIsDebuggable = default(bool?), object deprecatedSgxCollateral = null, System.BinaryData deprecatedEnclaveHeldData = null, System.BinaryData deprecatedEnclaveHeldData2 = null, float? deprecatedProductId = default(float?), string deprecatedMrEnclave = null, string deprecatedMrSigner = null, float? deprecatedSvn = default(float?), string deprecatedTee = null, Azure.Security.Attestation.AttestationSigner deprecatedPolicySigner = null, System.BinaryData deprecatedPolicyHash = null, string deprecatedRpData = null) { throw null; } + public static Azure.Security.Attestation.PolicyCertificatesModificationResult PolicyCertificatesModificationResult(Azure.Security.Attestation.PolicyCertificateResolution certificateResolution, string certificateThumbprint) { throw null; } + public static Azure.Security.Attestation.PolicyModificationResult PolicyModificationResult(Azure.Security.Attestation.PolicyModification policyModification, string policyHash, Azure.Security.Attestation.AttestationSigner signer) { throw null; } + } + public partial class AttestationRequest + { + public AttestationRequest() { } + public string DraftPolicyForAttestation { get { throw null; } set { } } + public System.BinaryData Evidence { get { throw null; } set { } } + public Azure.Security.Attestation.AttestationData InittimeData { get { throw null; } set { } } + public Azure.Security.Attestation.AttestationData RuntimeData { get { throw null; } set { } } + } + public partial class AttestationResponse : Azure.Response where T : class + { + internal AttestationResponse() { } + public Azure.Security.Attestation.AttestationToken Token { get { throw null; } } + public override T Value { get { throw null; } } + public override Azure.Response GetRawResponse() { throw null; } + } + public partial class AttestationResult + { + internal AttestationResult() { } + public object Confirmation { get { throw null; } } + [System.ObsoleteAttribute("DeprecatedEnclaveHeldData is deprecated, use EnclaveHeldData instead")] + public System.BinaryData DeprecatedEnclaveHeldData { get { throw null; } } + [System.ObsoleteAttribute("DeprecatedEnclaveHeldData2 is deprecated, use EnclaveHeldData instead")] + public System.BinaryData DeprecatedEnclaveHeldData2 { get { throw null; } } + [System.ObsoleteAttribute("DeprecatedIsDebuggable is deprecated, use IsDebuggable instead")] + public bool? DeprecatedIsDebuggable { get { throw null; } } + [System.ObsoleteAttribute("DeprecatedMrEnclave is deprecated, use MrEnclave instead")] + public string DeprecatedMrEnclave { get { throw null; } } + [System.ObsoleteAttribute("DeprecatedMrSigner is deprecated, use MrSigner instead")] + public string DeprecatedMrSigner { get { throw null; } } + [System.ObsoleteAttribute("DeprecatedPolicyHash is deprecated, use PolicyHash instead")] + public System.BinaryData DeprecatedPolicyHash { get { throw null; } } + [System.ObsoleteAttribute("DeprecatedPolicySigner is deprecated, use PolicySigner instead")] + public Azure.Security.Attestation.AttestationSigner DeprecatedPolicySigner { get { throw null; } } + [System.ObsoleteAttribute("DeprecatedProductId is deprecated, use ProductId instead")] + public float? DeprecatedProductId { get { throw null; } } + [System.ObsoleteAttribute("DeprecatedRpData is deprecated, use Nonce instead")] + public string DeprecatedRpData { get { throw null; } } + [System.ObsoleteAttribute("DeprecatedSgxCollateral is deprecated, use SgxCollateral instead")] + public object DeprecatedSgxCollateral { get { throw null; } } + [System.ObsoleteAttribute("DeprecatedSvn is deprecated, use Svn instead")] + public float? DeprecatedSvn { get { throw null; } } + [System.ObsoleteAttribute("DeprecatedTee is deprecated, use Tee instead")] + public string DeprecatedTee { get { throw null; } } + [System.ObsoleteAttribute("DeprecatedVersion is deprecated, use Version instead")] + public string DeprecatedVersion { get { throw null; } } + public System.BinaryData EnclaveHeldData { get { throw null; } } + public System.DateTimeOffset Expiration { get { throw null; } } + public object InittimeClaims { get { throw null; } } + public bool? IsDebuggable { get { throw null; } } + public System.DateTimeOffset IssuedAt { get { throw null; } } + public System.Uri Issuer { get { throw null; } } + public string MrEnclave { get { throw null; } } + public string MrSigner { get { throw null; } } + public string Nonce { get { throw null; } } + public System.DateTimeOffset NotBefore { get { throw null; } } + public object PolicyClaims { get { throw null; } } + public System.BinaryData PolicyHash { get { throw null; } } + public Azure.Security.Attestation.AttestationSigner PolicySigner { get { throw null; } } + public float? ProductId { get { throw null; } } + public object RuntimeClaims { get { throw null; } } + public object SgxCollateral { get { throw null; } } + public float? Svn { get { throw null; } } + public string UniqueIdentifier { get { throw null; } } + public string VerifierType { get { throw null; } } + public string Version { get { throw null; } } + } + public partial class AttestationSigner + { + public AttestationSigner(System.Collections.Generic.IEnumerable signingCertificates, string certificateKeyId) { } + public string CertificateKeyId { get { throw null; } } + public System.Collections.Generic.IReadOnlyList SigningCertificates { get { throw null; } } + } + public partial class AttestationToken + { + protected AttestationToken() { } + public AttestationToken(Azure.Security.Attestation.AttestationTokenSigningKey signingKey) { } + public AttestationToken(System.BinaryData body) { } + public AttestationToken(System.BinaryData body, Azure.Security.Attestation.AttestationTokenSigningKey signingKey) { } + public string Algorithm { get { throw null; } } + public string CertificateThumbprint { get { throw null; } } + public string ContentType { get { throw null; } } + public bool? Critical { get { throw null; } } + public System.DateTimeOffset? ExpirationTime { get { throw null; } } + public System.DateTimeOffset? IssuedAtTime { get { throw null; } } + public string Issuer { get { throw null; } } + public string KeyId { get { throw null; } } + public System.Uri KeyUrl { get { throw null; } } + public System.DateTimeOffset? NotBeforeTime { get { throw null; } } + public Azure.Security.Attestation.AttestationSigner SigningCertificate { get { throw null; } } + public System.ReadOnlyMemory TokenBodyBytes { get { throw null; } } + public System.ReadOnlyMemory TokenHeaderBytes { get { throw null; } } + public System.ReadOnlyMemory TokenSignatureBytes { get { throw null; } } + public string Type { get { throw null; } } + public System.Security.Cryptography.X509Certificates.X509Certificate2[] X509CertificateChain { get { throw null; } } + public string X509CertificateSha256Thumbprint { get { throw null; } } + public string X509CertificateThumbprint { get { throw null; } } + public System.Uri X509Url { get { throw null; } } + public static Azure.Security.Attestation.AttestationToken Deserialize(string token) { throw null; } + public virtual T GetBody() where T : class { throw null; } + public string Serialize() { throw null; } + public virtual bool ValidateToken(Azure.Security.Attestation.AttestationTokenValidationOptions options, System.Collections.Generic.IReadOnlyList attestationSigningCertificates, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ValidateTokenAsync(Azure.Security.Attestation.AttestationTokenValidationOptions options, System.Collections.Generic.IReadOnlyList attestationSigningCertificates, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class AttestationTokenSigningKey + { + public AttestationTokenSigningKey(System.Security.Cryptography.AsymmetricAlgorithm signer, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + public AttestationTokenSigningKey(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + public System.Security.Cryptography.X509Certificates.X509Certificate2 Certificate { get { throw null; } } + public System.Security.Cryptography.AsymmetricAlgorithm Signer { get { throw null; } } + } + public partial class AttestationTokenValidationEventArgs : Azure.SyncAsyncEventArgs + { + internal AttestationTokenValidationEventArgs() : base (default(bool), default(System.Threading.CancellationToken)) { } + public bool IsValid { get { throw null; } set { } } + public Azure.Security.Attestation.AttestationSigner Signer { get { throw null; } } + public Azure.Security.Attestation.AttestationToken Token { get { throw null; } } + } + public partial class AttestationTokenValidationFailedException : System.InvalidOperationException + { + public AttestationTokenValidationFailedException(string message) { } + public System.Collections.Generic.IReadOnlyList Signers { get { throw null; } } + public Azure.Security.Attestation.AttestationToken Token { get { throw null; } } + } + public partial class AttestationTokenValidationOptions + { + public AttestationTokenValidationOptions() { } + public string ExpectedIssuer { get { throw null; } set { } } + public long TimeValidationSlack { get { throw null; } set { } } + public bool ValidateExpirationTime { get { throw null; } set { } } + public bool ValidateIssuer { get { throw null; } set { } } + public bool ValidateNotBeforeTime { get { throw null; } set { } } + public bool ValidateToken { get { throw null; } set { } } + public event Azure.Core.SyncAsyncEventHandler TokenValidated { add { } remove { } } + public Azure.Security.Attestation.AttestationTokenValidationOptions Clone() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AttestationType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AttestationType(string value) { throw null; } + public static Azure.Security.Attestation.AttestationType OpenEnclave { get { throw null; } } + public static Azure.Security.Attestation.AttestationType SgxEnclave { get { throw null; } } + public static Azure.Security.Attestation.AttestationType Tpm { get { throw null; } } + public bool Equals(Azure.Security.Attestation.AttestationType other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Security.Attestation.AttestationType left, Azure.Security.Attestation.AttestationType right) { throw null; } + public static implicit operator Azure.Security.Attestation.AttestationType (string value) { throw null; } + public static bool operator !=(Azure.Security.Attestation.AttestationType left, Azure.Security.Attestation.AttestationType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PolicyCertificateResolution : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PolicyCertificateResolution(string value) { throw null; } + public static Azure.Security.Attestation.PolicyCertificateResolution IsAbsent { get { throw null; } } + public static Azure.Security.Attestation.PolicyCertificateResolution IsPresent { get { throw null; } } + public bool Equals(Azure.Security.Attestation.PolicyCertificateResolution other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Security.Attestation.PolicyCertificateResolution left, Azure.Security.Attestation.PolicyCertificateResolution right) { throw null; } + public static implicit operator Azure.Security.Attestation.PolicyCertificateResolution (string value) { throw null; } + public static bool operator !=(Azure.Security.Attestation.PolicyCertificateResolution left, Azure.Security.Attestation.PolicyCertificateResolution right) { throw null; } + public override string ToString() { throw null; } + } + public partial class PolicyCertificatesModificationResult + { + public PolicyCertificatesModificationResult() { } + public Azure.Security.Attestation.PolicyCertificateResolution? CertificateResolution { get { throw null; } set { } } + public string CertificateThumbprint { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PolicyModification : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PolicyModification(string value) { throw null; } + public static Azure.Security.Attestation.PolicyModification Removed { get { throw null; } } + public static Azure.Security.Attestation.PolicyModification Updated { get { throw null; } } + public bool Equals(Azure.Security.Attestation.PolicyModification other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Security.Attestation.PolicyModification left, Azure.Security.Attestation.PolicyModification right) { throw null; } + public static implicit operator Azure.Security.Attestation.PolicyModification (string value) { throw null; } + public static bool operator !=(Azure.Security.Attestation.PolicyModification left, Azure.Security.Attestation.PolicyModification right) { throw null; } + public override string ToString() { throw null; } + } + public partial class PolicyModificationResult + { + public PolicyModificationResult() { } + public Azure.Security.Attestation.PolicyModification PolicyResolution { get { throw null; } } + public Azure.Security.Attestation.AttestationSigner PolicySigner { get { throw null; } } + public System.BinaryData PolicyTokenHash { get { throw null; } } + } + public partial class StoredAttestationPolicy + { + public StoredAttestationPolicy() { } + public string AttestationPolicy { get { throw null; } set { } } + } + public partial class TpmAttestationRequest + { + public TpmAttestationRequest() { } + public System.BinaryData Data { get { throw null; } set { } } + } + public partial class TpmAttestationResponse + { + internal TpmAttestationResponse() { } + public System.BinaryData Data { get { throw null; } } + } +} diff --git a/sdk/attestation/Azure.Security.Attestation/src/AttestationAdministrationClient.cs b/sdk/attestation/Azure.Security.Attestation/src/AttestationAdministrationClient.cs index 147ed41565f0..6717ec0abf2e 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/AttestationAdministrationClient.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/AttestationAdministrationClient.cs @@ -487,7 +487,9 @@ private async Task>> GetPoli List certificates = new List(); foreach (var cert in token.GetBody().InternalPolicyCertificates.Keys) { +#pragma warning disable SYSLIB0057 // Type or member is obsolete certificates.Add(new X509Certificate2(Convert.FromBase64String(cert.X5C[0]))); +#pragma warning restore SYSLIB0057 // Type or member is obsolete } return new AttestationResponse>(result.GetRawResponse(), token, certificates.AsReadOnly()); } diff --git a/sdk/attestation/Azure.Security.Attestation/src/AttestationToken.cs b/sdk/attestation/Azure.Security.Attestation/src/AttestationToken.cs index 1ad49d92679b..8d40669df875 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/AttestationToken.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/AttestationToken.cs @@ -161,7 +161,9 @@ public X509Certificate2[] X509CertificateChain { List certificates = new List(); foreach (var certificate in Header.X509CertificateChain) { +#pragma warning disable SYSLIB0057 // Type or member is obsolete certificates.Add(new X509Certificate2(certificate)); +#pragma warning restore SYSLIB0057 // Type or member is obsolete } return certificates.ToArray(); } @@ -428,7 +430,9 @@ private static X509Certificate2[] ConvertBase64CertificateArrayToCertificateChai int i = 0; foreach (var base64Cert in base64certificates) { +#pragma warning disable SYSLIB0057 // Type or member is obsolete jwkCertificates[i] = new X509Certificate2(Convert.FromBase64String(base64Cert)); +#pragma warning restore SYSLIB0057 // Type or member is obsolete i += 1; } return jwkCertificates; diff --git a/sdk/attestation/Azure.Security.Attestation/src/Models/AttestationSigner.cs b/sdk/attestation/Azure.Security.Attestation/src/Models/AttestationSigner.cs index e2a0b674baef..aa9cdad851ac 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Models/AttestationSigner.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Models/AttestationSigner.cs @@ -60,7 +60,9 @@ internal static AttestationSigner FromJsonWebKey(JsonWebKey key) { foreach (string x5c in key.X5C) { +#pragma warning disable SYSLIB0057 // Type or member is obsolete certificates.Add(new X509Certificate2(Convert.FromBase64String(x5c))); +#pragma warning restore SYSLIB0057 // Type or member is obsolete } } return new AttestationSigner(certificates.ToArray(), keyId); diff --git a/sdk/attestation/Azure.Security.Attestation/src/Models/PolicyCertificatesResult.cs b/sdk/attestation/Azure.Security.Attestation/src/Models/PolicyCertificatesResult.cs index 27d46981f509..37a3a054600b 100644 --- a/sdk/attestation/Azure.Security.Attestation/src/Models/PolicyCertificatesResult.cs +++ b/sdk/attestation/Azure.Security.Attestation/src/Models/PolicyCertificatesResult.cs @@ -43,7 +43,9 @@ public IReadOnlyList GetPolicyCertificates() // the key returned must have a X5c property. throw new InvalidOperationException(Azure_Security_Attestation.PolicyCertificatesRequireX5C); } +#pragma warning disable SYSLIB0057 // Type or member is obsolete certificates.Add(new X509Certificate2(Convert.FromBase64String(key.X5C[0]))); +#pragma warning restore SYSLIB0057 // Type or member is obsolete } _certificateList = certificates; }