diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/api/Azure.ResourceManager.ContainerInstance.netstandard2.0.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/api/Azure.ResourceManager.ContainerInstance.netstandard2.0.cs index 70cc173b0c31..1e2b7ff28f79 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/api/Azure.ResourceManager.ContainerInstance.netstandard2.0.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/api/Azure.ResourceManager.ContainerInstance.netstandard2.0.cs @@ -71,6 +71,8 @@ protected ContainerGroupResource() { } } public static partial class ContainerInstanceExtensions { + public static Azure.ResourceManager.ArmOperation DeleteSubnetServiceAssociationLink(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.WaitUntil waitUntil, string virtualNetworkName, string subnetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task DeleteSubnetServiceAssociationLinkAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.WaitUntil waitUntil, string virtualNetworkName, string subnetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Pageable GetCachedImagesWithLocation(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetCachedImagesWithLocationAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Pageable GetCapabilitiesWithLocation(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -87,27 +89,6 @@ public static partial class ContainerInstanceExtensions } namespace Azure.ResourceManager.ContainerInstance.Models { - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct AutoGeneratedDomainNameLabelScope : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public AutoGeneratedDomainNameLabelScope(string value) { throw null; } - public static Azure.ResourceManager.ContainerInstance.Models.AutoGeneratedDomainNameLabelScope NoReuse { get { throw null; } } - public static Azure.ResourceManager.ContainerInstance.Models.AutoGeneratedDomainNameLabelScope ResourceGroupReuse { get { throw null; } } - public static Azure.ResourceManager.ContainerInstance.Models.AutoGeneratedDomainNameLabelScope SubscriptionReuse { get { throw null; } } - public static Azure.ResourceManager.ContainerInstance.Models.AutoGeneratedDomainNameLabelScope TenantReuse { get { throw null; } } - public static Azure.ResourceManager.ContainerInstance.Models.AutoGeneratedDomainNameLabelScope Unsecure { get { throw null; } } - public bool Equals(Azure.ResourceManager.ContainerInstance.Models.AutoGeneratedDomainNameLabelScope other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.ContainerInstance.Models.AutoGeneratedDomainNameLabelScope left, Azure.ResourceManager.ContainerInstance.Models.AutoGeneratedDomainNameLabelScope right) { throw null; } - public static implicit operator Azure.ResourceManager.ContainerInstance.Models.AutoGeneratedDomainNameLabelScope (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.ContainerInstance.Models.AutoGeneratedDomainNameLabelScope left, Azure.ResourceManager.ContainerInstance.Models.AutoGeneratedDomainNameLabelScope right) { throw null; } - public override string ToString() { throw null; } - } public partial class CachedImages { internal CachedImages() { } @@ -206,7 +187,7 @@ public ContainerGroupEncryptionProperties(System.Uri vaultBaseUri, string keyNam } public partial class ContainerGroupImageRegistryCredential { - public ContainerGroupImageRegistryCredential(string server, string username) { } + public ContainerGroupImageRegistryCredential(string server) { } public string Identity { get { throw null; } set { } } public System.Uri IdentityUri { get { throw null; } set { } } public string Password { get { throw null; } set { } } @@ -223,8 +204,8 @@ public partial class ContainerGroupIPAddress { public ContainerGroupIPAddress(System.Collections.Generic.IEnumerable ports, Azure.ResourceManager.ContainerInstance.Models.ContainerGroupIPAddressType addressType) { } public Azure.ResourceManager.ContainerInstance.Models.ContainerGroupIPAddressType AddressType { get { throw null; } set { } } + public Azure.ResourceManager.ContainerInstance.Models.DnsNameLabelReusePolicy? AutoGeneratedDomainNameLabelScope { get { throw null; } set { } } public string DnsNameLabel { get { throw null; } set { } } - public Azure.ResourceManager.ContainerInstance.Models.AutoGeneratedDomainNameLabelScope? DnsNameLabelReusePolicy { get { throw null; } set { } } public string Fqdn { get { throw null; } } public System.Net.IPAddress IP { get { throw null; } set { } } public System.Collections.Generic.IList Ports { get { throw null; } } @@ -429,6 +410,7 @@ public partial class ContainerInstanceUsage { internal ContainerInstanceUsage() { } public int? CurrentValue { get { throw null; } } + public string Id { get { throw null; } } public int? Limit { get { throw null; } } public Azure.ResourceManager.ContainerInstance.Models.ContainerInstanceUsageName Name { get { throw null; } } public string Unit { get { throw null; } } @@ -539,6 +521,27 @@ public ContainerVolumeMount(string name, string mountPath) { } public string MountPath { get { throw null; } set { } } public string Name { get { throw null; } set { } } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DnsNameLabelReusePolicy : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DnsNameLabelReusePolicy(string value) { throw null; } + public static Azure.ResourceManager.ContainerInstance.Models.DnsNameLabelReusePolicy NoReuse { get { throw null; } } + public static Azure.ResourceManager.ContainerInstance.Models.DnsNameLabelReusePolicy ResourceGroupReuse { get { throw null; } } + public static Azure.ResourceManager.ContainerInstance.Models.DnsNameLabelReusePolicy SubscriptionReuse { get { throw null; } } + public static Azure.ResourceManager.ContainerInstance.Models.DnsNameLabelReusePolicy TenantReuse { get { throw null; } } + public static Azure.ResourceManager.ContainerInstance.Models.DnsNameLabelReusePolicy Unsecure { get { throw null; } } + public bool Equals(Azure.ResourceManager.ContainerInstance.Models.DnsNameLabelReusePolicy other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.ContainerInstance.Models.DnsNameLabelReusePolicy left, Azure.ResourceManager.ContainerInstance.Models.DnsNameLabelReusePolicy right) { throw null; } + public static implicit operator Azure.ResourceManager.ContainerInstance.Models.DnsNameLabelReusePolicy (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ContainerInstance.Models.DnsNameLabelReusePolicy left, Azure.ResourceManager.ContainerInstance.Models.DnsNameLabelReusePolicy right) { throw null; } + public override string ToString() { throw null; } + } public partial class InitContainerDefinitionContent { public InitContainerDefinitionContent(string name) { } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupData.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupData.cs index 0348f16d8b0b..051ff1a42c4c 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupData.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/ContainerGroupData.cs @@ -29,13 +29,13 @@ public ContainerGroupData(AzureLocation location, IEnumerable(); Containers = containers.ToList(); ImageRegistryCredentials = new ChangeTrackingList(); OSType = osType; Volumes = new ChangeTrackingList(); SubnetIds = new ChangeTrackingList(); InitContainers = new ChangeTrackingList(); - Zones = new ChangeTrackingList(); } /// Initializes a new instance of ContainerGroupData. @@ -45,6 +45,7 @@ public ContainerGroupData(AzureLocation location, IEnumerable The systemData. /// The tags. /// The location. + /// The zones for the container group. /// The identity of the container group, if configured. /// The provisioning state of the container group. This only appears in the response. /// The containers within the container group. @@ -66,9 +67,9 @@ public ContainerGroupData(AzureLocation location, IEnumerable The SKU for a container group. /// The encryption properties for a container group. /// The init containers for a container group. - /// The zones for the container group. - internal ContainerGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, string provisioningState, IList containers, IList imageRegistryCredentials, ContainerGroupRestartPolicy? restartPolicy, ContainerGroupIPAddress ipAddress, ContainerInstanceOperatingSystemType osType, IList volumes, ContainerGroupInstanceView instanceView, ContainerGroupDiagnostics diagnostics, IList subnetIds, ContainerGroupDnsConfiguration dnsConfig, ContainerGroupSku? sku, ContainerGroupEncryptionProperties encryptionProperties, IList initContainers, IList zones) : base(id, name, resourceType, systemData, tags, location) + internal ContainerGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList zones, ManagedServiceIdentity identity, string provisioningState, IList containers, IList imageRegistryCredentials, ContainerGroupRestartPolicy? restartPolicy, ContainerGroupIPAddress ipAddress, ContainerInstanceOperatingSystemType osType, IList volumes, ContainerGroupInstanceView instanceView, ContainerGroupDiagnostics diagnostics, IList subnetIds, ContainerGroupDnsConfiguration dnsConfig, ContainerGroupSku? sku, ContainerGroupEncryptionProperties encryptionProperties, IList initContainers) : base(id, name, resourceType, systemData, tags, location) { + Zones = zones; Identity = identity; ProvisioningState = provisioningState; Containers = containers; @@ -84,9 +85,10 @@ internal ContainerGroupData(ResourceIdentifier id, string name, ResourceType res Sku = sku; EncryptionProperties = encryptionProperties; InitContainers = initContainers; - Zones = zones; } + /// The zones for the container group. + public IList Zones { get; } /// The identity of the container group, if configured. public ManagedServiceIdentity Identity { get; set; } /// The provisioning state of the container group. This only appears in the response. @@ -135,7 +137,5 @@ public ContainerGroupLogAnalytics DiagnosticsLogAnalytics public ContainerGroupEncryptionProperties EncryptionProperties { get; set; } /// The init containers for a container group. public IList InitContainers { get; } - /// The zones for the container group. - public IList Zones { get; } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ContainerInstanceExtensions.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ContainerInstanceExtensions.cs index 62892f36192e..cde1581db7c8 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ContainerInstanceExtensions.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ContainerInstanceExtensions.cs @@ -187,6 +187,46 @@ public static Response GetContainerGroup(this ResourceGr return resourceGroupResource.GetContainerGroups().Get(containerGroupName, cancellationToken); } + /// + /// Delete container group virtual network association links. The operation does not delete other resources provided by the user. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default + /// Operation Id: SubnetServiceAssociationLink_Delete + /// + /// The instance the method will execute against. + /// 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 name of the virtual network. + /// The name of the subnet. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public static async Task DeleteSubnetServiceAssociationLinkAsync(this ResourceGroupResource resourceGroupResource, WaitUntil waitUntil, string virtualNetworkName, string subnetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + Argument.AssertNotNullOrEmpty(subnetName, nameof(subnetName)); + + return await GetExtensionClient(resourceGroupResource).DeleteSubnetServiceAssociationLinkAsync(waitUntil, virtualNetworkName, subnetName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete container group virtual network association links. The operation does not delete other resources provided by the user. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default + /// Operation Id: SubnetServiceAssociationLink_Delete + /// + /// The instance the method will execute against. + /// 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 name of the virtual network. + /// The name of the subnet. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public static ArmOperation DeleteSubnetServiceAssociationLink(this ResourceGroupResource resourceGroupResource, WaitUntil waitUntil, string virtualNetworkName, string subnetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + Argument.AssertNotNullOrEmpty(subnetName, nameof(subnetName)); + + return GetExtensionClient(resourceGroupResource).DeleteSubnetServiceAssociationLink(waitUntil, virtualNetworkName, subnetName, cancellationToken); + } + #region ContainerGroupResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs index f152a06ce4fc..847460b5a60b 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs @@ -5,7 +5,12 @@ #nullable disable +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.Core.Pipeline; using Azure.ResourceManager; namespace Azure.ResourceManager.ContainerInstance @@ -13,6 +18,9 @@ namespace Azure.ResourceManager.ContainerInstance /// A class to add extension methods to ResourceGroupResource. internal partial class ResourceGroupResourceExtensionClient : ArmResource { + private ClientDiagnostics _subnetServiceAssociationLinkClientDiagnostics; + private SubnetServiceAssociationLinkRestOperations _subnetServiceAssociationLinkRestClient; + /// Initializes a new instance of the class for mocking. protected ResourceGroupResourceExtensionClient() { @@ -25,6 +33,9 @@ internal ResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifi { } + private ClientDiagnostics SubnetServiceAssociationLinkClientDiagnostics => _subnetServiceAssociationLinkClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerInstance", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private SubnetServiceAssociationLinkRestOperations SubnetServiceAssociationLinkRestClient => _subnetServiceAssociationLinkRestClient ??= new SubnetServiceAssociationLinkRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private string GetApiVersionOrNull(ResourceType resourceType) { TryGetApiVersion(resourceType, out string apiVersion); @@ -37,5 +48,61 @@ public virtual ContainerGroupCollection GetContainerGroups() { return GetCachedClient(Client => new ContainerGroupCollection(Client, Id)); } + + /// + /// Delete container group virtual network association links. The operation does not delete other resources provided by the user. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default + /// Operation Id: SubnetServiceAssociationLink_Delete + /// + /// 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 name of the virtual network. + /// The name of the subnet. + /// The cancellation token to use. + public virtual async Task DeleteSubnetServiceAssociationLinkAsync(WaitUntil waitUntil, string virtualNetworkName, string subnetName, CancellationToken cancellationToken = default) + { + using var scope = SubnetServiceAssociationLinkClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteSubnetServiceAssociationLink"); + scope.Start(); + try + { + var response = await SubnetServiceAssociationLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, subnetName, cancellationToken).ConfigureAwait(false); + var operation = new ContainerInstanceArmOperation(SubnetServiceAssociationLinkClientDiagnostics, Pipeline, SubnetServiceAssociationLinkRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, subnetName).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete container group virtual network association links. The operation does not delete other resources provided by the user. + /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default + /// Operation Id: SubnetServiceAssociationLink_Delete + /// + /// 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 name of the virtual network. + /// The name of the subnet. + /// The cancellation token to use. + public virtual ArmOperation DeleteSubnetServiceAssociationLink(WaitUntil waitUntil, string virtualNetworkName, string subnetName, CancellationToken cancellationToken = default) + { + using var scope = SubnetServiceAssociationLinkClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteSubnetServiceAssociationLink"); + scope.Start(); + try + { + var response = SubnetServiceAssociationLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, subnetName, cancellationToken); + var operation = new ContainerInstanceArmOperation(SubnetServiceAssociationLinkClientDiagnostics, Pipeline, SubnetServiceAssociationLinkRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkName, subnetName).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/AutoGeneratedDomainNameLabelScope.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/AutoGeneratedDomainNameLabelScope.cs deleted file mode 100644 index 6ecbafb92396..000000000000 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/AutoGeneratedDomainNameLabelScope.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerInstance.Models -{ - /// The value representing the security enum. - public readonly partial struct AutoGeneratedDomainNameLabelScope : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AutoGeneratedDomainNameLabelScope(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string UnsecureValue = "Unsecure"; - private const string TenantReuseValue = "TenantReuse"; - private const string SubscriptionReuseValue = "SubscriptionReuse"; - private const string ResourceGroupReuseValue = "ResourceGroupReuse"; - private const string NoReuseValue = "Noreuse"; - - /// Unsecure. - public static AutoGeneratedDomainNameLabelScope Unsecure { get; } = new AutoGeneratedDomainNameLabelScope(UnsecureValue); - /// TenantReuse. - public static AutoGeneratedDomainNameLabelScope TenantReuse { get; } = new AutoGeneratedDomainNameLabelScope(TenantReuseValue); - /// SubscriptionReuse. - public static AutoGeneratedDomainNameLabelScope SubscriptionReuse { get; } = new AutoGeneratedDomainNameLabelScope(SubscriptionReuseValue); - /// ResourceGroupReuse. - public static AutoGeneratedDomainNameLabelScope ResourceGroupReuse { get; } = new AutoGeneratedDomainNameLabelScope(ResourceGroupReuseValue); - /// Noreuse. - public static AutoGeneratedDomainNameLabelScope NoReuse { get; } = new AutoGeneratedDomainNameLabelScope(NoReuseValue); - /// Determines if two values are the same. - public static bool operator ==(AutoGeneratedDomainNameLabelScope left, AutoGeneratedDomainNameLabelScope right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AutoGeneratedDomainNameLabelScope left, AutoGeneratedDomainNameLabelScope right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator AutoGeneratedDomainNameLabelScope(string value) => new AutoGeneratedDomainNameLabelScope(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AutoGeneratedDomainNameLabelScope other && Equals(other); - /// - public bool Equals(AutoGeneratedDomainNameLabelScope other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupData.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupData.Serialization.cs index da2c282932f8..f726a033f300 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupData.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupData.Serialization.cs @@ -18,11 +18,6 @@ public partial class ContainerGroupData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(Identity)) - { - writer.WritePropertyName("identity"); - JsonSerializer.Serialize(writer, Identity); - } if (Optional.IsCollectionDefined(Zones)) { writer.WritePropertyName("zones"); @@ -33,6 +28,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + JsonSerializer.Serialize(writer, Identity); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"); @@ -133,8 +133,8 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ContainerGroupData DeserializeContainerGroupData(JsonElement element) { - Optional identity = default; Optional> zones = default; + Optional identity = default; Optional> tags = default; AzureLocation location = default; ResourceIdentifier id = default; @@ -157,29 +157,29 @@ internal static ContainerGroupData DeserializeContainerGroupData(JsonElement ele Optional> initContainers = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("identity")) + if (property.NameEquals("zones")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } - identity = JsonSerializer.Deserialize(property.Value.ToString()); + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + zones = array; continue; } - if (property.NameEquals("zones")) + if (property.NameEquals("identity")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - zones = array; + identity = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("tags")) @@ -390,7 +390,7 @@ internal static ContainerGroupData DeserializeContainerGroupData(JsonElement ele continue; } } - return new ContainerGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, provisioningState.Value, containers, Optional.ToList(imageRegistryCredentials), Optional.ToNullable(restartPolicy), ipAddress.Value, osType, Optional.ToList(volumes), instanceView.Value, diagnostics.Value, Optional.ToList(subnetIds), dnsConfig.Value, Optional.ToNullable(sku), encryptionProperties.Value, Optional.ToList(initContainers), Optional.ToList(zones)); + return new ContainerGroupData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(zones), identity, provisioningState.Value, containers, Optional.ToList(imageRegistryCredentials), Optional.ToNullable(restartPolicy), ipAddress.Value, osType, Optional.ToList(volumes), instanceView.Value, diagnostics.Value, Optional.ToList(subnetIds), dnsConfig.Value, Optional.ToNullable(sku), encryptionProperties.Value, Optional.ToList(initContainers)); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.Serialization.cs index e61caa650526..e2c218249c5c 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.Serialization.cs @@ -36,10 +36,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("dnsNameLabel"); writer.WriteStringValue(DnsNameLabel); } - if (Optional.IsDefined(DnsNameLabelReusePolicy)) + if (Optional.IsDefined(AutoGeneratedDomainNameLabelScope)) { - writer.WritePropertyName("dnsNameLabelReusePolicy"); - writer.WriteStringValue(DnsNameLabelReusePolicy.Value.ToString()); + writer.WritePropertyName("autoGeneratedDomainNameLabelScope"); + writer.WriteStringValue(AutoGeneratedDomainNameLabelScope.Value.ToString()); } writer.WriteEndObject(); } @@ -50,7 +50,7 @@ internal static ContainerGroupIPAddress DeserializeContainerGroupIPAddress(JsonE ContainerGroupIPAddressType type = default; Optional ip = default; Optional dnsNameLabel = default; - Optional dnsNameLabelReusePolicy = default; + Optional autoGeneratedDomainNameLabelScope = default; Optional fqdn = default; foreach (var property in element.EnumerateObject()) { @@ -84,14 +84,14 @@ internal static ContainerGroupIPAddress DeserializeContainerGroupIPAddress(JsonE dnsNameLabel = property.Value.GetString(); continue; } - if (property.NameEquals("dnsNameLabelReusePolicy")) + if (property.NameEquals("autoGeneratedDomainNameLabelScope")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } - dnsNameLabelReusePolicy = new AutoGeneratedDomainNameLabelScope(property.Value.GetString()); + autoGeneratedDomainNameLabelScope = new DnsNameLabelReusePolicy(property.Value.GetString()); continue; } if (property.NameEquals("fqdn")) @@ -100,7 +100,7 @@ internal static ContainerGroupIPAddress DeserializeContainerGroupIPAddress(JsonE continue; } } - return new ContainerGroupIPAddress(ports, type, ip.Value, dnsNameLabel.Value, Optional.ToNullable(dnsNameLabelReusePolicy), fqdn.Value); + return new ContainerGroupIPAddress(ports, type, ip.Value, dnsNameLabel.Value, Optional.ToNullable(autoGeneratedDomainNameLabelScope), fqdn.Value); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.cs index 702dc6091884..85c9086da3f4 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupIPAddress.cs @@ -35,15 +35,15 @@ public ContainerGroupIPAddress(IEnumerable ports, ContainerG /// Specifies if the IP is exposed to the public internet or private VNET. /// The IP exposed to the public internet. /// The Dns name label for the IP. - /// The value representing the security enum. + /// The value representing the security enum. The 'Unsecure' value is the default value if not selected and means the object's domain name label is not secured against subdomain takeover. The 'TenantReuse' value is the default value if selected and means the object's domain name label can be reused within the same tenant. The 'SubscriptionReuse' value means the object's domain name label can be reused within the same subscription. The 'ResourceGroupReuse' value means the object's domain name label can be reused within the same resource group. The 'NoReuse' value means the object's domain name label cannot be reused within the same resource group, subscription, or tenant. /// The FQDN for the IP. - internal ContainerGroupIPAddress(IList ports, ContainerGroupIPAddressType addressType, IPAddress ip, string dnsNameLabel, AutoGeneratedDomainNameLabelScope? dnsNameLabelReusePolicy, string fqdn) + internal ContainerGroupIPAddress(IList ports, ContainerGroupIPAddressType addressType, IPAddress ip, string dnsNameLabel, DnsNameLabelReusePolicy? autoGeneratedDomainNameLabelScope, string fqdn) { Ports = ports; AddressType = addressType; IP = ip; DnsNameLabel = dnsNameLabel; - DnsNameLabelReusePolicy = dnsNameLabelReusePolicy; + AutoGeneratedDomainNameLabelScope = autoGeneratedDomainNameLabelScope; Fqdn = fqdn; } @@ -55,8 +55,8 @@ internal ContainerGroupIPAddress(IList ports, ContainerGroup public IPAddress IP { get; set; } /// The Dns name label for the IP. public string DnsNameLabel { get; set; } - /// The value representing the security enum. - public AutoGeneratedDomainNameLabelScope? DnsNameLabelReusePolicy { get; set; } + /// The value representing the security enum. The 'Unsecure' value is the default value if not selected and means the object's domain name label is not secured against subdomain takeover. The 'TenantReuse' value is the default value if selected and means the object's domain name label can be reused within the same tenant. The 'SubscriptionReuse' value means the object's domain name label can be reused within the same subscription. The 'ResourceGroupReuse' value means the object's domain name label can be reused within the same resource group. The 'NoReuse' value means the object's domain name label cannot be reused within the same resource group, subscription, or tenant. + public DnsNameLabelReusePolicy? AutoGeneratedDomainNameLabelScope { get; set; } /// The FQDN for the IP. public string Fqdn { get; } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.Serialization.cs index 378c0f2f53fc..d30cca5c14aa 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.Serialization.cs @@ -18,8 +18,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("server"); writer.WriteStringValue(Server); - writer.WritePropertyName("username"); - writer.WriteStringValue(Username); + if (Optional.IsDefined(Username)) + { + writer.WritePropertyName("username"); + writer.WriteStringValue(Username); + } if (Optional.IsDefined(Password)) { writer.WritePropertyName("password"); @@ -41,7 +44,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ContainerGroupImageRegistryCredential DeserializeContainerGroupImageRegistryCredential(JsonElement element) { string server = default; - string username = default; + Optional username = default; Optional password = default; Optional identity = default; Optional identityUrl = default; @@ -78,7 +81,7 @@ internal static ContainerGroupImageRegistryCredential DeserializeContainerGroupI continue; } } - return new ContainerGroupImageRegistryCredential(server, username, password.Value, identity.Value, identityUrl.Value); + return new ContainerGroupImageRegistryCredential(server, username.Value, password.Value, identity.Value, identityUrl.Value); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.cs index dcca15659b14..70bc27181ac7 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerGroupImageRegistryCredential.cs @@ -14,21 +14,15 @@ public partial class ContainerGroupImageRegistryCredential { /// Initializes a new instance of ContainerGroupImageRegistryCredential. /// The Docker image registry server without a protocol such as "http" and "https". - /// The username for the private registry. - /// or is null. - public ContainerGroupImageRegistryCredential(string server, string username) + /// is null. + public ContainerGroupImageRegistryCredential(string server) { if (server == null) { throw new ArgumentNullException(nameof(server)); } - if (username == null) - { - throw new ArgumentNullException(nameof(username)); - } Server = server; - Username = username; } /// Initializes a new instance of ContainerGroupImageRegistryCredential. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.Serialization.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.Serialization.cs index aff30dba9a5c..20b611b6e4e9 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.Serialization.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.Serialization.cs @@ -14,12 +14,18 @@ public partial class ContainerInstanceUsage { internal static ContainerInstanceUsage DeserializeContainerInstanceUsage(JsonElement element) { + Optional id = default; Optional unit = default; Optional currentValue = default; Optional limit = default; Optional name = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("unit")) { unit = property.Value.GetString(); @@ -56,7 +62,7 @@ internal static ContainerInstanceUsage DeserializeContainerInstanceUsage(JsonEle continue; } } - return new ContainerInstanceUsage(unit.Value, Optional.ToNullable(currentValue), Optional.ToNullable(limit), name.Value); + return new ContainerInstanceUsage(id.Value, unit.Value, Optional.ToNullable(currentValue), Optional.ToNullable(limit), name.Value); } } } diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.cs index afcc8341e330..7c071c284840 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/ContainerInstanceUsage.cs @@ -16,18 +16,22 @@ internal ContainerInstanceUsage() } /// Initializes a new instance of ContainerInstanceUsage. + /// Id of the usage result. /// Unit of the usage result. /// The current usage of the resource. /// The maximum permitted usage of the resource. /// The name object of the resource. - internal ContainerInstanceUsage(string unit, int? currentValue, int? limit, ContainerInstanceUsageName name) + internal ContainerInstanceUsage(string id, string unit, int? currentValue, int? limit, ContainerInstanceUsageName name) { + Id = id; Unit = unit; CurrentValue = currentValue; Limit = limit; Name = name; } + /// Id of the usage result. + public string Id { get; } /// Unit of the usage result. public string Unit { get; } /// The current usage of the resource. diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/DnsNameLabelReusePolicy.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/DnsNameLabelReusePolicy.cs new file mode 100644 index 000000000000..0155798242e2 --- /dev/null +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Models/DnsNameLabelReusePolicy.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ContainerInstance.Models +{ + /// The value representing the security enum. The 'Unsecure' value is the default value if not selected and means the object's domain name label is not secured against subdomain takeover. The 'TenantReuse' value is the default value if selected and means the object's domain name label can be reused within the same tenant. The 'SubscriptionReuse' value means the object's domain name label can be reused within the same subscription. The 'ResourceGroupReuse' value means the object's domain name label can be reused within the same resource group. The 'NoReuse' value means the object's domain name label cannot be reused within the same resource group, subscription, or tenant. + public readonly partial struct DnsNameLabelReusePolicy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DnsNameLabelReusePolicy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnsecureValue = "Unsecure"; + private const string TenantReuseValue = "TenantReuse"; + private const string SubscriptionReuseValue = "SubscriptionReuse"; + private const string ResourceGroupReuseValue = "ResourceGroupReuse"; + private const string NoReuseValue = "Noreuse"; + + /// Unsecure. + public static DnsNameLabelReusePolicy Unsecure { get; } = new DnsNameLabelReusePolicy(UnsecureValue); + /// TenantReuse. + public static DnsNameLabelReusePolicy TenantReuse { get; } = new DnsNameLabelReusePolicy(TenantReuseValue); + /// SubscriptionReuse. + public static DnsNameLabelReusePolicy SubscriptionReuse { get; } = new DnsNameLabelReusePolicy(SubscriptionReuseValue); + /// ResourceGroupReuse. + public static DnsNameLabelReusePolicy ResourceGroupReuse { get; } = new DnsNameLabelReusePolicy(ResourceGroupReuseValue); + /// Noreuse. + public static DnsNameLabelReusePolicy NoReuse { get; } = new DnsNameLabelReusePolicy(NoReuseValue); + /// Determines if two values are the same. + public static bool operator ==(DnsNameLabelReusePolicy left, DnsNameLabelReusePolicy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DnsNameLabelReusePolicy left, DnsNameLabelReusePolicy right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DnsNameLabelReusePolicy(string value) => new DnsNameLabelReusePolicy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DnsNameLabelReusePolicy other && Equals(other); + /// + public bool Equals(DnsNameLabelReusePolicy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/RestOperations/ContainerGroupsRestOperations.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/RestOperations/ContainerGroupsRestOperations.cs index 9a7f51f40ee1..df89cbf45273 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/RestOperations/ContainerGroupsRestOperations.cs +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/RestOperations/ContainerGroupsRestOperations.cs @@ -673,6 +673,7 @@ public async Task StartAsync(string subscriptionId, string resourceGro switch (message.Response.Status) { case 202: + case 204: return message.Response; default: throw new RequestFailedException(message.Response); @@ -697,6 +698,7 @@ public Response Start(string subscriptionId, string resourceGroupName, string co switch (message.Response.Status) { case 202: + case 204: return message.Response; default: throw new RequestFailedException(message.Response); diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/RestOperations/SubnetServiceAssociationLinkRestOperations.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/RestOperations/SubnetServiceAssociationLinkRestOperations.cs new file mode 100644 index 000000000000..a726478dfaa7 --- /dev/null +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/RestOperations/SubnetServiceAssociationLinkRestOperations.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.ContainerInstance +{ + internal partial class SubnetServiceAssociationLinkRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SubnetServiceAssociationLinkRestOperations. + /// 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 SubnetServiceAssociationLinkRestOperations(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-10-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string virtualNetworkName, string subnetName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + 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.Network/virtualNetworks/", false); + uri.AppendPath(virtualNetworkName, true); + uri.AppendPath("/subnets/", false); + uri.AppendPath(subnetName, true); + uri.AppendPath("/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete container group virtual network association links. The operation does not delete other resources provided by the user. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the virtual network. + /// The name of the subnet. + /// 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 virtualNetworkName, string subnetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + Argument.AssertNotNullOrEmpty(subnetName, nameof(subnetName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, virtualNetworkName, subnetName); + 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 container group virtual network association links. The operation does not delete other resources provided by the user. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the virtual network. + /// The name of the subnet. + /// 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 virtualNetworkName, string subnetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + Argument.AssertNotNullOrEmpty(subnetName, nameof(subnetName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, virtualNetworkName, subnetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/autorest.md b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/autorest.md index fbe7d5b13ce0..68c4f6fd87c3 100644 --- a/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/autorest.md +++ b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/autorest.md @@ -6,7 +6,7 @@ Run `dotnet build /t:GenerateCode` to generate code. azure-arm: true library-name: ContainerInstance namespace: Azure.ResourceManager.ContainerInstance -require: https://github.com/Azure/azure-rest-api-specs/blob/4716fb039c67e1bee1d5448af9ce57e4942832fe/specification/containerinstance/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true skip-csproj: true