diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs index fd4155e12c41..f313f210f106 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs @@ -632,7 +632,9 @@ protected InstancePoolCollection() { } public partial class InstancePoolData : Azure.ResourceManager.Models.TrackedResourceData { public InstancePoolData(Azure.Core.AzureLocation location) { } + public string DnsZone { get { throw null; } } public Azure.ResourceManager.Sql.Models.InstancePoolLicenseType? LicenseType { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier MaintenanceConfigurationId { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.SqlSku Sku { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } public int? VCores { get { throw null; } set { } } @@ -698,6 +700,43 @@ protected IPv6FirewallRuleResource() { } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.IPv6FirewallRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.IPv6FirewallRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class JobPrivateEndpointCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected JobPrivateEndpointCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string privateEndpointName, Azure.ResourceManager.Sql.JobPrivateEndpointData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string privateEndpointName, Azure.ResourceManager.Sql.JobPrivateEndpointData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class JobPrivateEndpointData : Azure.ResourceManager.Models.ResourceData + { + public JobPrivateEndpointData() { } + public string PrivateEndpointId { get { throw null; } } + public Azure.Core.ResourceIdentifier TargetServerAzureResourceId { get { throw null; } set { } } + } + public partial class JobPrivateEndpointResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected JobPrivateEndpointResource() { } + public virtual Azure.ResourceManager.Sql.JobPrivateEndpointData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.JobPrivateEndpointData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.JobPrivateEndpointData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } public partial class LedgerDigestUploadCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected LedgerDigestUploadCollection() { } @@ -3411,6 +3450,7 @@ public static partial class SqlExtensions public static Azure.Pageable GetInstancePools(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetInstancePoolsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.Sql.IPv6FirewallRuleResource GetIPv6FirewallRuleResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Sql.JobPrivateEndpointResource GetJobPrivateEndpointResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Sql.LedgerDigestUploadResource GetLedgerDigestUploadResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Sql.LogicalDatabaseTransparentDataEncryptionResource GetLogicalDatabaseTransparentDataEncryptionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -4194,6 +4234,9 @@ protected SqlServerJobAgentResource() { } public virtual Azure.Pageable GetJobExecutionsByAgent(System.DateTimeOffset? createTimeMin = default(System.DateTimeOffset?), System.DateTimeOffset? createTimeMax = default(System.DateTimeOffset?), System.DateTimeOffset? endTimeMin = default(System.DateTimeOffset?), System.DateTimeOffset? endTimeMax = default(System.DateTimeOffset?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetJobExecutionsByAgentAsync(Azure.ResourceManager.Sql.Models.SqlServerJobAgentResourceGetJobExecutionsByAgentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetJobExecutionsByAgentAsync(System.DateTimeOffset? createTimeMin = default(System.DateTimeOffset?), System.DateTimeOffset? createTimeMax = default(System.DateTimeOffset?), System.DateTimeOffset? endTimeMin = default(System.DateTimeOffset?), System.DateTimeOffset? endTimeMax = default(System.DateTimeOffset?), bool? isActive = default(bool?), int? skip = default(int?), int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetJobPrivateEndpoint(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetJobPrivateEndpointAsync(string privateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Sql.JobPrivateEndpointCollection GetJobPrivateEndpoints() { throw null; } public virtual Azure.Response GetSqlServerJob(string jobName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetSqlServerJobAsync(string jobName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetSqlServerJobCredential(string credentialName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -5529,6 +5572,7 @@ protected MockableSqlArmClient() { } public virtual Azure.ResourceManager.Sql.InstanceFailoverGroupResource GetInstanceFailoverGroupResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Sql.InstancePoolResource GetInstancePoolResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Sql.IPv6FirewallRuleResource GetIPv6FirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Sql.JobPrivateEndpointResource GetJobPrivateEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Sql.LedgerDigestUploadResource GetLedgerDigestUploadResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Sql.LogicalDatabaseTransparentDataEncryptionResource GetLogicalDatabaseTransparentDataEncryptionResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Sql.LongTermRetentionPolicyResource GetLongTermRetentionPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } @@ -5842,7 +5886,7 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.Models.ImportExportExtensionsOperationResult ImportExportExtensionsOperationResult(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Guid? requestId = default(System.Guid?), string requestType = null, string lastModifiedTime = null, string serverName = null, string databaseName = null, string status = null, string errorMessage = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ImportExportOperationResult ImportExportOperationResult(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Guid? requestId = default(System.Guid?), string requestType = null, string queuedTime = null, string lastModifiedTime = null, System.Uri blobUri = null, string serverName = null, string databaseName = null, string status = null, string errorMessage = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null) { throw null; } public static Azure.ResourceManager.Sql.InstanceFailoverGroupData InstanceFailoverGroupData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Sql.Models.GeoSecondaryInstanceType? secondaryType = default(Azure.ResourceManager.Sql.Models.GeoSecondaryInstanceType?), Azure.ResourceManager.Sql.Models.InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint = null, Azure.ResourceManager.Sql.Models.ReadOnlyEndpointFailoverPolicy? readOnlyEndpointFailoverPolicy = default(Azure.ResourceManager.Sql.Models.ReadOnlyEndpointFailoverPolicy?), Azure.ResourceManager.Sql.Models.InstanceFailoverGroupReplicationRole? replicationRole = default(Azure.ResourceManager.Sql.Models.InstanceFailoverGroupReplicationRole?), string replicationState = null, System.Collections.Generic.IEnumerable partnerRegions = null, System.Collections.Generic.IEnumerable managedInstancePairs = null) { throw null; } - public static Azure.ResourceManager.Sql.InstancePoolData InstancePoolData(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), Azure.ResourceManager.Sql.Models.SqlSku sku = null, Azure.Core.ResourceIdentifier subnetId = null, int? vCores = default(int?), Azure.ResourceManager.Sql.Models.InstancePoolLicenseType? licenseType = default(Azure.ResourceManager.Sql.Models.InstancePoolLicenseType?)) { throw null; } + public static Azure.ResourceManager.Sql.InstancePoolData InstancePoolData(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), Azure.ResourceManager.Sql.Models.SqlSku sku = null, Azure.Core.ResourceIdentifier subnetId = null, int? vCores = default(int?), Azure.ResourceManager.Sql.Models.InstancePoolLicenseType? licenseType = default(Azure.ResourceManager.Sql.Models.InstancePoolLicenseType?), string dnsZone = null, Azure.Core.ResourceIdentifier maintenanceConfigurationId = null) { throw null; } public static Azure.ResourceManager.Sql.Models.InstancePoolEditionCapability InstancePoolEditionCapability(string name = null, System.Collections.Generic.IEnumerable supportedFamilies = null, Azure.ResourceManager.Sql.Models.SqlCapabilityStatus? status = default(Azure.ResourceManager.Sql.Models.SqlCapabilityStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.Sql.Models.InstancePoolFamilyCapability InstancePoolFamilyCapability(string name = null, System.Collections.Generic.IEnumerable supportedLicenseTypes = null, System.Collections.Generic.IEnumerable supportedVcoresValues = null, Azure.ResourceManager.Sql.Models.SqlCapabilityStatus? status = default(Azure.ResourceManager.Sql.Models.SqlCapabilityStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.Sql.Models.InstancePoolUsage InstancePoolUsage(Azure.Core.ResourceIdentifier id = null, Azure.ResourceManager.Sql.Models.InstancePoolUsageName name = null, Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), string unit = null, int? currentValue = default(int?), int? limit = default(int?), int? requestedLimit = default(int?)) { throw null; } @@ -5850,6 +5894,7 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.Models.InstancePoolVcoresCapability InstancePoolVcoresCapability(string name = null, int? value = default(int?), Azure.ResourceManager.Sql.Models.MaxSizeCapability storageLimit = null, Azure.ResourceManager.Sql.Models.SqlCapabilityStatus? status = default(Azure.ResourceManager.Sql.Models.SqlCapabilityStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.Sql.IPv6FirewallRuleData IPv6FirewallRuleData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), string startIPv6Address = null, string endIPv6Address = null) { throw null; } public static Azure.ResourceManager.Sql.Models.JobExecutionTarget JobExecutionTarget(Azure.ResourceManager.Sql.Models.JobTargetType? targetType = default(Azure.ResourceManager.Sql.Models.JobTargetType?), string serverName = null, string databaseName = null) { throw null; } + public static Azure.ResourceManager.Sql.JobPrivateEndpointData JobPrivateEndpointData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier targetServerAzureResourceId = null, string privateEndpointId = null) { throw null; } public static Azure.ResourceManager.Sql.LedgerDigestUploadData LedgerDigestUploadData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string digestStorageEndpoint = null, Azure.ResourceManager.Sql.Models.LedgerDigestUploadsState? state = default(Azure.ResourceManager.Sql.Models.LedgerDigestUploadsState?)) { throw null; } public static Azure.ResourceManager.Sql.Models.LicenseTypeCapability LicenseTypeCapability(string name = null, Azure.ResourceManager.Sql.Models.SqlCapabilityStatus? status = default(Azure.ResourceManager.Sql.Models.SqlCapabilityStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.Sql.LogicalDatabaseTransparentDataEncryptionData LogicalDatabaseTransparentDataEncryptionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Sql.Models.TransparentDataEncryptionState? state = default(Azure.ResourceManager.Sql.Models.TransparentDataEncryptionState?)) { throw null; } @@ -6875,7 +6920,13 @@ internal InstancePoolFamilyCapability() { } public partial class InstancePoolPatch { public InstancePoolPatch() { } + public string DnsZone { get { throw null; } } + public Azure.ResourceManager.Sql.Models.InstancePoolLicenseType? LicenseType { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier MaintenanceConfigurationId { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.SqlSku Sku { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + public int? VCores { get { throw null; } set { } } } public partial class InstancePoolUsage { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolCollection.cs index 26fcc9d57f26..e4fd137d825b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolCollection.cs @@ -19,12 +19,48 @@ namespace Azure.ResourceManager.Sql.Samples { public partial class Sample_InstancePoolCollection { + // List instance pools by resource group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListInstancePoolsByResourceGroup() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ListInstancePoolsByResourceGroup.json + // this example is just showing the usage of "InstancePools_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this InstancePoolResource + InstancePoolCollection collection = resourceGroupResource.GetInstancePools(); + + // invoke the operation and iterate over the result + await foreach (InstancePoolResource item in collection.GetAllAsync()) + { + // 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 + InstancePoolData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + // Get an instance pool [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAnInstancePool() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetInstancePool.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetInstancePool.json // this example is just showing the usage of "InstancePools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -58,7 +94,7 @@ public async Task Get_GetAnInstancePool() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAnInstancePool() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetInstancePool.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetInstancePool.json // this example is just showing the usage of "InstancePools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -88,7 +124,7 @@ public async Task Exists_GetAnInstancePool() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAnInstancePool() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetInstancePool.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetInstancePool.json // this example is just showing the usage of "InstancePools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -130,7 +166,7 @@ public async Task GetIfExists_GetAnInstancePool() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateAnInstancePoolWithAllProperties() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateInstancePoolMax.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/CreateOrUpdateInstancePoolMax.json // this example is just showing the usage of "InstancePools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -160,6 +196,7 @@ public async Task CreateOrUpdate_CreateAnInstancePoolWithAllProperties() SubnetId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet1"), VCores = 8, LicenseType = InstancePoolLicenseType.LicenseIncluded, + MaintenanceConfigurationId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), Tags = { ["a"] = "b", @@ -180,7 +217,7 @@ public async Task CreateOrUpdate_CreateAnInstancePoolWithAllProperties() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateAnInstancePoolWithMinProperties() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateInstancePoolMin.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/CreateOrUpdateInstancePoolMin.json // this example is just showing the usage of "InstancePools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -220,41 +257,5 @@ public async Task CreateOrUpdate_CreateAnInstancePoolWithMinProperties() // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - - // List instance pools by resource group - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_ListInstancePoolsByResourceGroup() - { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListInstancePoolsByResourceGroup.json - // this example is just showing the usage of "InstancePools_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "00000000-1111-2222-3333-444444444444"; - string resourceGroupName = "group1"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this InstancePoolResource - InstancePoolCollection collection = resourceGroupResource.GetInstancePools(); - - // invoke the operation and iterate over the result - await foreach (InstancePoolResource item in collection.GetAllAsync()) - { - // 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 - InstancePoolData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolResource.cs index 9253c0e9d9cf..51420da52bee 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolResource.cs @@ -19,13 +19,13 @@ namespace Azure.ResourceManager.Sql.Samples { public partial class Sample_InstancePoolResource { - // Get an instance pool + // List instance pool usages expanded with children. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_GetAnInstancePool() + public async Task GetUsages_ListInstancePoolUsagesExpandedWithChildren() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetInstancePool.json - // this example is just showing the usage of "InstancePools_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsageExpanded.json + // this example is just showing the usage of "Usages_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -40,23 +40,23 @@ public async Task Get_GetAnInstancePool() ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); - // invoke the operation - InstancePoolResource result = await instancePool.GetAsync(); + // invoke the operation and iterate over the result + bool? expandChildren = true; + await foreach (InstancePoolUsage item in instancePool.GetUsagesAsync(expandChildren: expandChildren)) + { + Console.WriteLine($"Succeeded: {item}"); + } - // 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 - InstancePoolData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded"); } - // Delete an instance pool + // List instance pool usages. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Delete_DeleteAnInstancePool() + public async Task GetUsages_ListInstancePoolUsages() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteInstancePool.json - // this example is just showing the usage of "InstancePools_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsage.json + // this example is just showing the usage of "Usages_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -71,19 +71,22 @@ public async Task Delete_DeleteAnInstancePool() ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); - // invoke the operation - await instancePool.DeleteAsync(WaitUntil.Completed); + // invoke the operation and iterate over the result + await foreach (InstancePoolUsage item in instancePool.GetUsagesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } Console.WriteLine($"Succeeded"); } - // Patch an instance pool + // List managed instances by instance pool [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_PatchAnInstancePool() + public async Task GetManagedInstances_ListManagedInstancesByInstancePool() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PatchInstancePool.json - // this example is just showing the usage of "InstancePools_Update" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByInstancePool.json + // this example is just showing the usage of "ManagedInstances_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -92,55 +95,52 @@ public async Task Update_PatchAnInstancePool() // this example assumes you already have this InstancePoolResource created on azure // for more information of creating InstancePoolResource, please refer to the document of InstancePoolResource - string subscriptionId = "00000000-1111-2222-3333-444444444444"; - string resourceGroupName = "group1"; - string instancePoolName = "testIP"; + string subscriptionId = "20D7082A-0FC7-4468-82BD-542694D5042B"; + string resourceGroupName = "Test1"; + string instancePoolName = "pool1"; ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); - // invoke the operation - InstancePoolPatch patch = new InstancePoolPatch() + // invoke the operation and iterate over the result + await foreach (ManagedInstanceResource item in instancePool.GetManagedInstancesAsync()) { - Tags = -{ -["x"] = "y", -}, - }; - ArmOperation lro = await instancePool.UpdateAsync(WaitUntil.Completed, patch); - InstancePoolResource result = lro.Value; + // 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 + ManagedInstanceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } - // 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 - InstancePoolData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded"); } - // List instance pools in the subscription + // List managed instances by instance pool with $expand=administrators/activedirectory [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetInstancePools_ListInstancePoolsInTheSubscription() + public async Task GetManagedInstances_ListManagedInstancesByInstancePoolWithExpandAdministratorsActivedirectory() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListInstancePoolsBySubscriptionId.json - // this example is just showing the usage of "InstancePools_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByInstancePoolWithExpandEqualsAdministrators.json + // this example is just showing the usage of "ManagedInstances_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this SubscriptionResource created on azure - // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "00000000-1111-2222-3333-444444444444"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + // this example assumes you already have this InstancePoolResource created on azure + // for more information of creating InstancePoolResource, please refer to the document of InstancePoolResource + string subscriptionId = "20D7082A-0FC7-4468-82BD-542694D5042B"; + string resourceGroupName = "Test1"; + string instancePoolName = "pool1"; + ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); + InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); // invoke the operation and iterate over the result - await foreach (InstancePoolResource item in subscriptionResource.GetInstancePoolsAsync()) + await foreach (ManagedInstanceResource item in instancePool.GetManagedInstancesAsync()) { // 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 - InstancePoolData resourceData = item.Data; + ManagedInstanceData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } @@ -148,44 +148,45 @@ public async Task GetInstancePools_ListInstancePoolsInTheSubscription() Console.WriteLine($"Succeeded"); } - // List instance pool usages expanded with children. + // List instance pools in the subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetUsages_ListInstancePoolUsagesExpandedWithChildren() + public async Task GetInstancePools_ListInstancePoolsInTheSubscription() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsageExpanded.json - // this example is just showing the usage of "Usages_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ListInstancePoolsBySubscriptionId.json + // this example is just showing the usage of "InstancePools_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this InstancePoolResource created on azure - // for more information of creating InstancePoolResource, please refer to the document of InstancePoolResource + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource string subscriptionId = "00000000-1111-2222-3333-444444444444"; - string resourceGroupName = "group1"; - string instancePoolName = "testIP"; - ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); - InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - bool? expandChildren = true; - await foreach (InstancePoolUsage item in instancePool.GetUsagesAsync(expandChildren: expandChildren)) + await foreach (InstancePoolResource item in subscriptionResource.GetInstancePoolsAsync()) { - Console.WriteLine($"Succeeded: {item}"); + // 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 + InstancePoolData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } Console.WriteLine($"Succeeded"); } - // List instance pool usages. + // Get an instance pool [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetUsages_ListInstancePoolUsages() + public async Task Get_GetAnInstancePool() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsage.json - // this example is just showing the usage of "Usages_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetInstancePool.json + // this example is just showing the usage of "InstancePools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -200,22 +201,23 @@ public async Task GetUsages_ListInstancePoolUsages() ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); - // invoke the operation and iterate over the result - await foreach (InstancePoolUsage item in instancePool.GetUsagesAsync()) - { - Console.WriteLine($"Succeeded: {item}"); - } + // invoke the operation + InstancePoolResource result = await instancePool.GetAsync(); - Console.WriteLine($"Succeeded"); + // 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 + InstancePoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // List managed instances by instance pool + // Delete an instance pool [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetManagedInstances_ListManagedInstancesByInstancePool() + public async Task Delete_DeleteAnInstancePool() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByInstancePool.json - // this example is just showing the usage of "ManagedInstances_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/DeleteInstancePool.json + // this example is just showing the usage of "InstancePools_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -224,32 +226,25 @@ public async Task GetManagedInstances_ListManagedInstancesByInstancePool() // this example assumes you already have this InstancePoolResource created on azure // for more information of creating InstancePoolResource, please refer to the document of InstancePoolResource - string subscriptionId = "20D7082A-0FC7-4468-82BD-542694D5042B"; - string resourceGroupName = "Test1"; - string instancePoolName = "pool1"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string instancePoolName = "testIP"; ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); - // invoke the operation and iterate over the result - await foreach (ManagedInstanceResource item in instancePool.GetManagedInstancesAsync()) - { - // 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 - ManagedInstanceData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } + // invoke the operation + await instancePool.DeleteAsync(WaitUntil.Completed); Console.WriteLine($"Succeeded"); } - // List managed instances by instance pool with $expand=administrators/activedirectory + // Patch an instance pool [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetManagedInstances_ListManagedInstancesByInstancePoolWithExpandAdministratorsActivedirectory() + public async Task Update_PatchAnInstancePool() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByInstancePoolWithExpandEqualsAdministrators.json - // this example is just showing the usage of "ManagedInstances_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/PatchInstancePool.json + // this example is just showing the usage of "InstancePools_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -258,23 +253,28 @@ public async Task GetManagedInstances_ListManagedInstancesByInstancePoolWithExpa // this example assumes you already have this InstancePoolResource created on azure // for more information of creating InstancePoolResource, please refer to the document of InstancePoolResource - string subscriptionId = "20D7082A-0FC7-4468-82BD-542694D5042B"; - string resourceGroupName = "Test1"; - string instancePoolName = "pool1"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string instancePoolName = "testIP"; ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); InstancePoolResource instancePool = client.GetInstancePoolResource(instancePoolResourceId); - // invoke the operation and iterate over the result - await foreach (ManagedInstanceResource item in instancePool.GetManagedInstancesAsync()) + // invoke the operation + InstancePoolPatch patch = new InstancePoolPatch() { - // 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 - ManagedInstanceData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } + Tags = +{ +["x"] = "y", +}, + }; + ArmOperation lro = await instancePool.UpdateAsync(WaitUntil.Completed, patch); + InstancePoolResource result = lro.Value; - Console.WriteLine($"Succeeded"); + // 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 + InstancePoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_JobPrivateEndpointCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_JobPrivateEndpointCollection.cs new file mode 100644 index 000000000000..c79ee0038e8c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_JobPrivateEndpointCollection.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Samples +{ + public partial class Sample_JobPrivateEndpointCollection + { + // List private endpoints in a job agent + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListPrivateEndpointsInAJobAgent() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ListJobPrivateEndpointsByAgent.json + // this example is just showing the usage of "JobPrivateEndpoints_ListByAgent" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SqlServerJobAgentResource created on azure + // for more information of creating SqlServerJobAgentResource, please refer to the document of SqlServerJobAgentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + ResourceIdentifier sqlServerJobAgentResourceId = SqlServerJobAgentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName); + SqlServerJobAgentResource sqlServerJobAgent = client.GetSqlServerJobAgentResource(sqlServerJobAgentResourceId); + + // get the collection of this JobPrivateEndpointResource + JobPrivateEndpointCollection collection = sqlServerJobAgent.GetJobPrivateEndpoints(); + + // invoke the operation and iterate over the result + await foreach (JobPrivateEndpointResource item in collection.GetAllAsync()) + { + // 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 + JobPrivateEndpointData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a private endpoint. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAPrivateEndpoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetJobPrivateEndpoint.json + // this example is just showing the usage of "JobPrivateEndpoints_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SqlServerJobAgentResource created on azure + // for more information of creating SqlServerJobAgentResource, please refer to the document of SqlServerJobAgentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + ResourceIdentifier sqlServerJobAgentResourceId = SqlServerJobAgentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName); + SqlServerJobAgentResource sqlServerJobAgent = client.GetSqlServerJobAgentResource(sqlServerJobAgentResourceId); + + // get the collection of this JobPrivateEndpointResource + JobPrivateEndpointCollection collection = sqlServerJobAgent.GetJobPrivateEndpoints(); + + // invoke the operation + string privateEndpointName = "endpoint1"; + JobPrivateEndpointResource result = await collection.GetAsync(privateEndpointName); + + // 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 + JobPrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a private endpoint. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAPrivateEndpoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetJobPrivateEndpoint.json + // this example is just showing the usage of "JobPrivateEndpoints_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SqlServerJobAgentResource created on azure + // for more information of creating SqlServerJobAgentResource, please refer to the document of SqlServerJobAgentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + ResourceIdentifier sqlServerJobAgentResourceId = SqlServerJobAgentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName); + SqlServerJobAgentResource sqlServerJobAgent = client.GetSqlServerJobAgentResource(sqlServerJobAgentResourceId); + + // get the collection of this JobPrivateEndpointResource + JobPrivateEndpointCollection collection = sqlServerJobAgent.GetJobPrivateEndpoints(); + + // invoke the operation + string privateEndpointName = "endpoint1"; + bool result = await collection.ExistsAsync(privateEndpointName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a private endpoint. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAPrivateEndpoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetJobPrivateEndpoint.json + // this example is just showing the usage of "JobPrivateEndpoints_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SqlServerJobAgentResource created on azure + // for more information of creating SqlServerJobAgentResource, please refer to the document of SqlServerJobAgentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + ResourceIdentifier sqlServerJobAgentResourceId = SqlServerJobAgentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName); + SqlServerJobAgentResource sqlServerJobAgent = client.GetSqlServerJobAgentResource(sqlServerJobAgentResourceId); + + // get the collection of this JobPrivateEndpointResource + JobPrivateEndpointCollection collection = sqlServerJobAgent.GetJobPrivateEndpoints(); + + // invoke the operation + string privateEndpointName = "endpoint1"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointName); + JobPrivateEndpointResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // 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 + JobPrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create a private endpoint. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateAPrivateEndpoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/CreateOrUpdateJobPrivateEndpoint.json + // this example is just showing the usage of "JobPrivateEndpoints_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SqlServerJobAgentResource created on azure + // for more information of creating SqlServerJobAgentResource, please refer to the document of SqlServerJobAgentResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + ResourceIdentifier sqlServerJobAgentResourceId = SqlServerJobAgentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName); + SqlServerJobAgentResource sqlServerJobAgent = client.GetSqlServerJobAgentResource(sqlServerJobAgentResourceId); + + // get the collection of this JobPrivateEndpointResource + JobPrivateEndpointCollection collection = sqlServerJobAgent.GetJobPrivateEndpoints(); + + // invoke the operation + string privateEndpointName = "endpoint1"; + JobPrivateEndpointData data = new JobPrivateEndpointData() + { + TargetServerAzureResourceId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/targetserver1"), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointName, data); + JobPrivateEndpointResource result = lro.Value; + + // 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 + JobPrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_JobPrivateEndpointResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_JobPrivateEndpointResource.cs new file mode 100644 index 000000000000..1fa1cc1e642b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_JobPrivateEndpointResource.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Samples +{ + public partial class Sample_JobPrivateEndpointResource + { + // Get a private endpoint. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAPrivateEndpoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/GetJobPrivateEndpoint.json + // this example is just showing the usage of "JobPrivateEndpoints_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this JobPrivateEndpointResource created on azure + // for more information of creating JobPrivateEndpointResource, please refer to the document of JobPrivateEndpointResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + string privateEndpointName = "endpoint1"; + ResourceIdentifier jobPrivateEndpointResourceId = JobPrivateEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName); + JobPrivateEndpointResource jobPrivateEndpoint = client.GetJobPrivateEndpointResource(jobPrivateEndpointResourceId); + + // invoke the operation + JobPrivateEndpointResource result = await jobPrivateEndpoint.GetAsync(); + + // 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 + JobPrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create a private endpoint. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateAPrivateEndpoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/CreateOrUpdateJobPrivateEndpoint.json + // this example is just showing the usage of "JobPrivateEndpoints_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this JobPrivateEndpointResource created on azure + // for more information of creating JobPrivateEndpointResource, please refer to the document of JobPrivateEndpointResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + string privateEndpointName = "endpoint1"; + ResourceIdentifier jobPrivateEndpointResourceId = JobPrivateEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName); + JobPrivateEndpointResource jobPrivateEndpoint = client.GetJobPrivateEndpointResource(jobPrivateEndpointResourceId); + + // invoke the operation + JobPrivateEndpointData data = new JobPrivateEndpointData() + { + TargetServerAzureResourceId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/targetserver1"), + }; + ArmOperation lro = await jobPrivateEndpoint.UpdateAsync(WaitUntil.Completed, data); + JobPrivateEndpointResource result = lro.Value; + + // 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 + JobPrivateEndpointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete a private endpoint + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteAPrivateEndpoint() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/DeleteJobPrivateEndpoint.json + // this example is just showing the usage of "JobPrivateEndpoints_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this JobPrivateEndpointResource created on azure + // for more information of creating JobPrivateEndpointResource, please refer to the document of JobPrivateEndpointResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "group1"; + string serverName = "server1"; + string jobAgentName = "agent1"; + string privateEndpointName = "endpoint1"; + ResourceIdentifier jobPrivateEndpointResourceId = JobPrivateEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName); + JobPrivateEndpointResource jobPrivateEndpoint = client.GetJobPrivateEndpointResource(jobPrivateEndpointResourceId); + + // invoke the operation + await jobPrivateEndpoint.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ArmSqlModelFactory.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ArmSqlModelFactory.cs index db2c5a2b1bf2..afde39b0d0f9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ArmSqlModelFactory.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ArmSqlModelFactory.cs @@ -615,25 +615,6 @@ public static ResourceWithWritableName ResourceWithWritableName(ResourceIdentifi return new ResourceWithWritableName(id, name, resourceType); } - /// Initializes a new instance of InstancePoolData. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The name and tier of the SKU. - /// Resource ID of the subnet to place this instance pool in. - /// Count of vCores belonging to this instance pool. - /// The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). - /// A new instance for mocking. - public static InstancePoolData InstancePoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SqlSku sku = null, ResourceIdentifier subnetId = null, int? vCores = null, InstancePoolLicenseType? licenseType = null) - { - tags ??= new Dictionary(); - - return new InstancePoolData(id, name, resourceType, systemData, tags, location, sku, subnetId, vCores, licenseType); - } - /// Initializes a new instance of SqlServerJobAgentData. /// The id. /// The name. @@ -699,6 +680,19 @@ public static JobExecutionTarget JobExecutionTarget(JobTargetType? targetType = return new JobExecutionTarget(targetType, serverName, databaseName); } + /// Initializes a new instance of JobPrivateEndpointData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// ARM resource id of the server the private endpoint will target. + /// Private endpoint id of the private endpoint. + /// A new instance for mocking. + public static JobPrivateEndpointData JobPrivateEndpointData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier targetServerAzureResourceId = null, string privateEndpointId = null) + { + return new JobPrivateEndpointData(id, name, resourceType, systemData, targetServerAzureResourceId, privateEndpointId); + } + /// Initializes a new instance of SqlServerJobData. /// The id. /// The name. @@ -3919,5 +3913,26 @@ public static PartnerServerInfo PartnerServerInfo(ResourceIdentifier id = null, { return new PartnerServerInfo(id, location, replicationRole); } + + /// Initializes a new instance of InstancePoolData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The name and tier of the SKU. + /// Resource ID of the subnet to place this instance pool in. + /// Count of vCores belonging to this instance pool. + /// The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). + /// The Dns Zone that the managed instance pool is in. + /// Specifies maintenance configuration id to apply to this managed instance. + /// A new instance for mocking. + public static InstancePoolData InstancePoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SqlSku sku = null, ResourceIdentifier subnetId = null, int? vCores = null, InstancePoolLicenseType? licenseType = null, string dnsZone = null, ResourceIdentifier maintenanceConfigurationId = null) + { + tags ??= new Dictionary(); + + return new InstancePoolData(id, name, resourceType, systemData, tags, location, sku, subnetId, vCores, licenseType, dnsZone, maintenanceConfigurationId); + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs index 338990c9744b..3f1275d26b38 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs @@ -336,18 +336,6 @@ public virtual SqlFirewallRuleResource GetSqlFirewallRuleResource(ResourceIdenti return new SqlFirewallRuleResource(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. - /// - /// The resource ID of the resource to get. - /// Returns a object. - public virtual InstancePoolResource GetInstancePoolResource(ResourceIdentifier id) - { - InstancePoolResource.ValidateResourceId(id); - return new InstancePoolResource(Client, id); - } - /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -408,6 +396,18 @@ public virtual SqlServerJobExecutionStepTargetResource GetSqlServerJobExecutionS return new SqlServerJobExecutionStepTargetResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual JobPrivateEndpointResource GetJobPrivateEndpointResource(ResourceIdentifier id) + { + JobPrivateEndpointResource.ValidateResourceId(id); + return new JobPrivateEndpointResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -1547,5 +1547,17 @@ public virtual FailoverGroupResource GetFailoverGroupResource(ResourceIdentifier FailoverGroupResource.ValidateResourceId(id); return new FailoverGroupResource(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. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual InstancePoolResource GetInstancePoolResource(ResourceIdentifier id) + { + InstancePoolResource.ValidateResourceId(id); + return new InstancePoolResource(Client, id); + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlResourceGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlResourceGroupResource.cs index 38d2f45777fc..3f25cb28e81b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlResourceGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlResourceGroupResource.cs @@ -49,59 +49,6 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } - /// Gets a collection of InstancePoolResources in the ResourceGroupResource. - /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. - public virtual InstancePoolCollection GetInstancePools() - { - return GetCachedClient(client => new InstancePoolCollection(client, Id)); - } - - /// - /// Gets an instance pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// - /// - /// Operation Id - /// InstancePools_Get - /// - /// - /// - /// The name of the instance pool to be retrieved. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetInstancePoolAsync(string instancePoolName, CancellationToken cancellationToken = default) - { - return await GetInstancePools().GetAsync(instancePoolName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets an instance pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// - /// - /// Operation Id - /// InstancePools_Get - /// - /// - /// - /// The name of the instance pool to be retrieved. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetInstancePool(string instancePoolName, CancellationToken cancellationToken = default) - { - return GetInstancePools().Get(instancePoolName, cancellationToken); - } - /// Gets a collection of SqlServerTrustGroupResources in the ResourceGroupResource. /// The name of the region where the resource is located. /// An object representing collection of SqlServerTrustGroupResources and their operations over a SqlServerTrustGroupResource. @@ -505,6 +452,59 @@ public virtual Response GetSqlServer(string serverName, strin return GetSqlServers().Get(serverName, expand, cancellationToken); } + /// Gets a collection of InstancePoolResources in the ResourceGroupResource. + /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. + public virtual InstancePoolCollection GetInstancePools() + { + return GetCachedClient(client => new InstancePoolCollection(client, Id)); + } + + /// + /// Gets an instance pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} + /// + /// + /// Operation Id + /// InstancePools_Get + /// + /// + /// + /// The name of the instance pool to be retrieved. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetInstancePoolAsync(string instancePoolName, CancellationToken cancellationToken = default) + { + return await GetInstancePools().GetAsync(instancePoolName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an instance pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} + /// + /// + /// Operation Id + /// InstancePools_Get + /// + /// + /// + /// The name of the instance pool to be retrieved. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetInstancePool(string instancePoolName, CancellationToken cancellationToken = default) + { + return GetInstancePools().Get(instancePoolName, cancellationToken); + } + /// /// Lists the long term retention backups for a given location. /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlSubscriptionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlSubscriptionResource.cs index 47d234de5f55..7465bd61bdb0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlSubscriptionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlSubscriptionResource.cs @@ -25,8 +25,6 @@ public partial class MockableSqlSubscriptionResource : ArmResource { private ClientDiagnostics _deletedServerClientDiagnostics; private DeletedServersRestOperations _deletedServerRestClient; - private ClientDiagnostics _instancePoolClientDiagnostics; - private InstancePoolsRestOperations _instancePoolRestClient; private ClientDiagnostics _capabilitiesClientDiagnostics; private CapabilitiesRestOperations _capabilitiesRestClient; private ClientDiagnostics _syncGroupClientDiagnostics; @@ -41,6 +39,8 @@ public partial class MockableSqlSubscriptionResource : ArmResource private ManagedInstancesRestOperations _managedInstanceRestClient; private ClientDiagnostics _sqlServerServersClientDiagnostics; private ServersRestOperations _sqlServerServersRestClient; + private ClientDiagnostics _instancePoolClientDiagnostics; + private InstancePoolsRestOperations _instancePoolRestClient; /// Initializes a new instance of the class for mocking. protected MockableSqlSubscriptionResource() @@ -56,8 +56,6 @@ internal MockableSqlSubscriptionResource(ArmClient client, ResourceIdentifier id private ClientDiagnostics DeletedServerClientDiagnostics => _deletedServerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", DeletedServerResource.ResourceType.Namespace, Diagnostics); private DeletedServersRestOperations DeletedServerRestClient => _deletedServerRestClient ??= new DeletedServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeletedServerResource.ResourceType)); - private ClientDiagnostics InstancePoolClientDiagnostics => _instancePoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", InstancePoolResource.ResourceType.Namespace, Diagnostics); - private InstancePoolsRestOperations InstancePoolRestClient => _instancePoolRestClient ??= new InstancePoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(InstancePoolResource.ResourceType)); private ClientDiagnostics CapabilitiesClientDiagnostics => _capabilitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); private CapabilitiesRestOperations CapabilitiesRestClient => _capabilitiesRestClient ??= new CapabilitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics SyncGroupClientDiagnostics => _syncGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", SyncGroupResource.ResourceType.Namespace, Diagnostics); @@ -72,6 +70,8 @@ internal MockableSqlSubscriptionResource(ArmClient client, ResourceIdentifier id private ManagedInstancesRestOperations ManagedInstanceRestClient => _managedInstanceRestClient ??= new ManagedInstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedInstanceResource.ResourceType)); private ClientDiagnostics SqlServerServersClientDiagnostics => _sqlServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", SqlServerResource.ResourceType.Namespace, Diagnostics); private ServersRestOperations SqlServerServersRestClient => _sqlServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SqlServerResource.ResourceType)); + private ClientDiagnostics InstancePoolClientDiagnostics => _instancePoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", InstancePoolResource.ResourceType.Namespace, Diagnostics); + private InstancePoolsRestOperations InstancePoolRestClient => _instancePoolRestClient ??= new InstancePoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(InstancePoolResource.ResourceType)); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -419,50 +419,6 @@ public virtual Pageable GetDeletedServers(CancellationTok return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedServerResource(Client, DeletedServerData.DeserializeDeletedServerData(e)), DeletedServerClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetDeletedServers", "value", "nextLink", cancellationToken); } - /// - /// Gets a list of all instance pools in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools - /// - /// - /// Operation Id - /// InstancePools_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetInstancePoolsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => InstancePoolRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstancePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InstancePoolResource(Client, InstancePoolData.DeserializeInstancePoolData(e)), InstancePoolClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetInstancePools", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all instance pools in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools - /// - /// - /// Operation Id - /// InstancePools_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetInstancePools(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => InstancePoolRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstancePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InstancePoolResource(Client, InstancePoolData.DeserializeInstancePoolData(e)), InstancePoolClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetInstancePools", "value", "nextLink", cancellationToken); - } - /// /// Gets the subscription capabilities available for the specified location. /// @@ -996,5 +952,49 @@ public virtual Pageable GetSqlServers(string expand = null, C HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SqlServerServersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SqlServerResource(Client, SqlServerData.DeserializeSqlServerData(e)), SqlServerServersClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetSqlServers", "value", "nextLink", cancellationToken); } + + /// + /// Gets a list of all instance pools in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools + /// + /// + /// Operation Id + /// InstancePools_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetInstancePoolsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => InstancePoolRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstancePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InstancePoolResource(Client, InstancePoolData.DeserializeInstancePoolData(e)), InstancePoolClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetInstancePools", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all instance pools in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools + /// + /// + /// Operation Id + /// InstancePools_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetInstancePools(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => InstancePoolRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstancePoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InstancePoolResource(Client, InstancePoolData.DeserializeInstancePoolData(e)), InstancePoolClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetInstancePools", "value", "nextLink", cancellationToken); + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs index 66bf00adace0..ef742a8d5acb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs @@ -436,22 +436,6 @@ public static SqlFirewallRuleResource GetSqlFirewallRuleResource(this ArmClient return GetMockableSqlArmClient(client).GetSqlFirewallRuleResource(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. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static InstancePoolResource GetInstancePoolResource(this ArmClient client, ResourceIdentifier id) - { - return GetMockableSqlArmClient(client).GetInstancePoolResource(id); - } - /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -532,6 +516,22 @@ public static SqlServerJobExecutionStepTargetResource GetSqlServerJobExecutionSt return GetMockableSqlArmClient(client).GetSqlServerJobExecutionStepTargetResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static JobPrivateEndpointResource GetJobPrivateEndpointResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableSqlArmClient(client).GetJobPrivateEndpointResource(id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -2053,73 +2053,19 @@ public static FailoverGroupResource GetFailoverGroupResource(this ArmClient clie } /// - /// Gets a collection of InstancePoolResources in the ResourceGroupResource. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. - public static InstancePoolCollection GetInstancePools(this ResourceGroupResource resourceGroupResource) - { - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePools(); - } - - /// - /// Gets an instance pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// - /// - /// Operation Id - /// InstancePools_Get - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the instance pool to be retrieved. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public static async Task> GetInstancePoolAsync(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) - { - return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePoolAsync(instancePoolName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets an instance pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} - /// - /// - /// Operation Id - /// InstancePools_Get - /// - /// + /// 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. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. - /// The name of the instance pool to be retrieved. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public static Response GetInstancePool(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static InstancePoolResource GetInstancePoolResource(this ArmClient client, ResourceIdentifier id) { - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePool(instancePoolName, cancellationToken); + return GetMockableSqlArmClient(client).GetInstancePoolResource(id); } /// @@ -2644,6 +2590,76 @@ public static Response GetSqlServer(this ResourceGroupResourc return GetMockableSqlResourceGroupResource(resourceGroupResource).GetSqlServer(serverName, expand, cancellationToken); } + /// + /// Gets a collection of InstancePoolResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. + public static InstancePoolCollection GetInstancePools(this ResourceGroupResource resourceGroupResource) + { + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePools(); + } + + /// + /// Gets an instance pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} + /// + /// + /// Operation Id + /// InstancePools_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the instance pool to be retrieved. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetInstancePoolAsync(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) + { + return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePoolAsync(instancePoolName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an instance pool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} + /// + /// + /// Operation Id + /// InstancePools_Get + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the instance pool to be retrieved. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetInstancePool(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) + { + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePool(instancePoolName, cancellationToken); + } + /// /// Lists the long term retention backups for a given location. /// @@ -3311,56 +3327,6 @@ public static Pageable GetDeletedServers(this Subscriptio return GetMockableSqlSubscriptionResource(subscriptionResource).GetDeletedServers(cancellationToken); } - /// - /// Gets a list of all instance pools in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools - /// - /// - /// Operation Id - /// InstancePools_List - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetInstancePoolsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) - { - return GetMockableSqlSubscriptionResource(subscriptionResource).GetInstancePoolsAsync(cancellationToken); - } - - /// - /// Gets a list of all instance pools in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools - /// - /// - /// Operation Id - /// InstancePools_List - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetInstancePools(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) - { - return GetMockableSqlSubscriptionResource(subscriptionResource).GetInstancePools(cancellationToken); - } - /// /// Gets the subscription capabilities available for the specified location. /// @@ -3906,5 +3872,55 @@ public static Pageable GetSqlServers(this SubscriptionResourc { return GetMockableSqlSubscriptionResource(subscriptionResource).GetSqlServers(expand, cancellationToken); } + + /// + /// Gets a list of all instance pools in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools + /// + /// + /// Operation Id + /// InstancePools_List + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetInstancePoolsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetMockableSqlSubscriptionResource(subscriptionResource).GetInstancePoolsAsync(cancellationToken); + } + + /// + /// Gets a list of all instance pools in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools + /// + /// + /// Operation Id + /// InstancePools_List + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetInstancePools(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetMockableSqlSubscriptionResource(subscriptionResource).GetInstancePools(cancellationToken); + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolData.cs index c640d7e07d01..69f2267ba233 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolData.cs @@ -35,12 +35,16 @@ public InstancePoolData(AzureLocation location) : base(location) /// Resource ID of the subnet to place this instance pool in. /// Count of vCores belonging to this instance pool. /// The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). - internal InstancePoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SqlSku sku, ResourceIdentifier subnetId, int? vCores, InstancePoolLicenseType? licenseType) : base(id, name, resourceType, systemData, tags, location) + /// The Dns Zone that the managed instance pool is in. + /// Specifies maintenance configuration id to apply to this managed instance. + internal InstancePoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SqlSku sku, ResourceIdentifier subnetId, int? vCores, InstancePoolLicenseType? licenseType, string dnsZone, ResourceIdentifier maintenanceConfigurationId) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; SubnetId = subnetId; VCores = vCores; LicenseType = licenseType; + DnsZone = dnsZone; + MaintenanceConfigurationId = maintenanceConfigurationId; } /// The name and tier of the SKU. @@ -51,5 +55,9 @@ internal InstancePoolData(ResourceIdentifier id, string name, ResourceType resou public int? VCores { get; set; } /// The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). public InstancePoolLicenseType? LicenseType { get; set; } + /// The Dns Zone that the managed instance pool is in. + public string DnsZone { get; } + /// Specifies maintenance configuration id to apply to this managed instance. + public ResourceIdentifier MaintenanceConfigurationId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointCollection.cs new file mode 100644 index 000000000000..556049af0d31 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +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.Sql +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetJobPrivateEndpoints method from an instance of . + /// + public partial class JobPrivateEndpointCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _jobPrivateEndpointClientDiagnostics; + private readonly JobPrivateEndpointsRestOperations _jobPrivateEndpointRestClient; + + /// Initializes a new instance of the class for mocking. + protected JobPrivateEndpointCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal JobPrivateEndpointCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _jobPrivateEndpointClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", JobPrivateEndpointResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(JobPrivateEndpointResource.ResourceType, out string jobPrivateEndpointApiVersion); + _jobPrivateEndpointRestClient = new JobPrivateEndpointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, jobPrivateEndpointApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SqlServerJobAgentResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SqlServerJobAgentResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_CreateOrUpdate + /// + /// + /// + /// 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 private endpoint. + /// The requested private endpoint state. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string privateEndpointName, JobPrivateEndpointData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _jobPrivateEndpointRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, data, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new JobPrivateEndpointOperationSource(Client), _jobPrivateEndpointClientDiagnostics, Pipeline, _jobPrivateEndpointRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_CreateOrUpdate + /// + /// + /// + /// 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 private endpoint. + /// The requested private endpoint state. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string privateEndpointName, JobPrivateEndpointData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _jobPrivateEndpointRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, data, cancellationToken); + var operation = new SqlArmOperation(new JobPrivateEndpointOperationSource(Client), _jobPrivateEndpointClientDiagnostics, Pipeline, _jobPrivateEndpointRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.Get"); + scope.Start(); + try + { + var response = await _jobPrivateEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new JobPrivateEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.Get"); + scope.Start(); + try + { + var response = _jobPrivateEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new JobPrivateEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of job agent private endpoints. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints + /// + /// + /// Operation Id + /// JobPrivateEndpoints_ListByAgent + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _jobPrivateEndpointRestClient.CreateListByAgentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _jobPrivateEndpointRestClient.CreateListByAgentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new JobPrivateEndpointResource(Client, JobPrivateEndpointData.DeserializeJobPrivateEndpointData(e)), _jobPrivateEndpointClientDiagnostics, Pipeline, "JobPrivateEndpointCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of job agent private endpoints. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints + /// + /// + /// Operation Id + /// JobPrivateEndpoints_ListByAgent + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _jobPrivateEndpointRestClient.CreateListByAgentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _jobPrivateEndpointRestClient.CreateListByAgentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new JobPrivateEndpointResource(Client, JobPrivateEndpointData.DeserializeJobPrivateEndpointData(e)), _jobPrivateEndpointClientDiagnostics, Pipeline, "JobPrivateEndpointCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.Exists"); + scope.Start(); + try + { + var response = await _jobPrivateEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.Exists"); + scope.Start(); + try + { + var response = _jobPrivateEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _jobPrivateEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new JobPrivateEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointCollection.GetIfExists"); + scope.Start(); + try + { + var response = _jobPrivateEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, privateEndpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new JobPrivateEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointData.cs new file mode 100644 index 000000000000..b7e1c19ce582 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointData.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A class representing the JobPrivateEndpoint data model. + /// A job agent private endpoint. + /// + public partial class JobPrivateEndpointData : ResourceData + { + /// Initializes a new instance of JobPrivateEndpointData. + public JobPrivateEndpointData() + { + } + + /// Initializes a new instance of JobPrivateEndpointData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// ARM resource id of the server the private endpoint will target. + /// Private endpoint id of the private endpoint. + internal JobPrivateEndpointData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier targetServerAzureResourceId, string privateEndpointId) : base(id, name, resourceType, systemData) + { + TargetServerAzureResourceId = targetServerAzureResourceId; + PrivateEndpointId = privateEndpointId; + } + + /// ARM resource id of the server the private endpoint will target. + public ResourceIdentifier TargetServerAzureResourceId { get; set; } + /// Private endpoint id of the private endpoint. + public string PrivateEndpointId { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointResource.cs new file mode 100644 index 000000000000..b97711221266 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobPrivateEndpointResource.cs @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + /// + /// A Class representing a JobPrivateEndpoint 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 GetJobPrivateEndpointResource method. + /// Otherwise you can get one from its parent resource using the GetJobPrivateEndpoint method. + /// + public partial class JobPrivateEndpointResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The serverName. + /// The jobAgentName. + /// The privateEndpointName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _jobPrivateEndpointClientDiagnostics; + private readonly JobPrivateEndpointsRestOperations _jobPrivateEndpointRestClient; + private readonly JobPrivateEndpointData _data; + + /// Initializes a new instance of the class for mocking. + protected JobPrivateEndpointResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal JobPrivateEndpointResource(ArmClient client, JobPrivateEndpointData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal JobPrivateEndpointResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _jobPrivateEndpointClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Sql", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string jobPrivateEndpointApiVersion); + _jobPrivateEndpointRestClient = new JobPrivateEndpointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, jobPrivateEndpointApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Sql/servers/jobAgents/privateEndpoints"; + + /// 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 JobPrivateEndpointData 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 private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointResource.Get"); + scope.Start(); + try + { + var response = await _jobPrivateEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new JobPrivateEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointResource.Get"); + scope.Start(); + try + { + var response = _jobPrivateEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new JobPrivateEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_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 cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointResource.Delete"); + scope.Start(); + try + { + var response = await _jobPrivateEndpointRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(_jobPrivateEndpointClientDiagnostics, Pipeline, _jobPrivateEndpointRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_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 cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointResource.Delete"); + scope.Start(); + try + { + var response = _jobPrivateEndpointRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new SqlArmOperation(_jobPrivateEndpointClientDiagnostics, Pipeline, _jobPrivateEndpointRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_CreateOrUpdate + /// + /// + /// + /// 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 requested private endpoint state. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, JobPrivateEndpointData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointResource.Update"); + scope.Start(); + try + { + var response = await _jobPrivateEndpointRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new JobPrivateEndpointOperationSource(Client), _jobPrivateEndpointClientDiagnostics, Pipeline, _jobPrivateEndpointRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_CreateOrUpdate + /// + /// + /// + /// 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 requested private endpoint state. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, JobPrivateEndpointData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _jobPrivateEndpointClientDiagnostics.CreateScope("JobPrivateEndpointResource.Update"); + scope.Start(); + try + { + var response = _jobPrivateEndpointRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new SqlArmOperation(new JobPrivateEndpointOperationSource(Client), _jobPrivateEndpointClientDiagnostics, Pipeline, _jobPrivateEndpointRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/JobPrivateEndpointOperationSource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/JobPrivateEndpointOperationSource.cs new file mode 100644 index 000000000000..ee88f6ef2b06 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/JobPrivateEndpointOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Sql +{ + internal class JobPrivateEndpointOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal JobPrivateEndpointOperationSource(ArmClient client) + { + _client = client; + } + + JobPrivateEndpointResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = JobPrivateEndpointData.DeserializeJobPrivateEndpointData(document.RootElement); + return new JobPrivateEndpointResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = JobPrivateEndpointData.DeserializeJobPrivateEndpointData(document.RootElement); + return new JobPrivateEndpointResource(_client, data); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolData.Serialization.cs index 1b38d7d40830..9a4d980c0d07 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolData.Serialization.cs @@ -53,6 +53,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("licenseType"u8); writer.WriteStringValue(LicenseType.Value.ToString()); } + if (Optional.IsDefined(MaintenanceConfigurationId)) + { + writer.WritePropertyName("maintenanceConfigurationId"u8); + writer.WriteStringValue(MaintenanceConfigurationId); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -73,6 +78,8 @@ internal static InstancePoolData DeserializeInstancePoolData(JsonElement element Optional subnetId = default; Optional vCores = default; Optional licenseType = default; + Optional dnsZone = default; + Optional maintenanceConfigurationId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku"u8)) @@ -163,11 +170,25 @@ internal static InstancePoolData DeserializeInstancePoolData(JsonElement element licenseType = new InstancePoolLicenseType(property0.Value.GetString()); continue; } + if (property0.NameEquals("dnsZone"u8)) + { + dnsZone = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("maintenanceConfigurationId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maintenanceConfigurationId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } } continue; } } - return new InstancePoolData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, subnetId.Value, Optional.ToNullable(vCores), Optional.ToNullable(licenseType)); + return new InstancePoolData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, subnetId.Value, Optional.ToNullable(vCores), Optional.ToNullable(licenseType), dnsZone.Value, maintenanceConfigurationId.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.Serialization.cs index 9c8236e7e893..efec08e572fe 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.Serialization.cs @@ -15,6 +15,11 @@ public partial class InstancePoolPatch : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -26,6 +31,29 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(SubnetId)) + { + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); + } + if (Optional.IsDefined(VCores)) + { + writer.WritePropertyName("vCores"u8); + writer.WriteNumberValue(VCores.Value); + } + if (Optional.IsDefined(LicenseType)) + { + writer.WritePropertyName("licenseType"u8); + writer.WriteStringValue(LicenseType.Value.ToString()); + } + if (Optional.IsDefined(MaintenanceConfigurationId)) + { + writer.WritePropertyName("maintenanceConfigurationId"u8); + writer.WriteStringValue(MaintenanceConfigurationId); + } + writer.WriteEndObject(); writer.WriteEndObject(); } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.cs index 5a1fb196b380..7d11e18d3cd4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstancePoolPatch.cs @@ -19,7 +19,19 @@ public InstancePoolPatch() Tags = new ChangeTrackingDictionary(); } + /// The name and tier of the SKU. + public SqlSku Sku { get; set; } /// Resource tags. public IDictionary Tags { get; } + /// Resource ID of the subnet to place this instance pool in. + public ResourceIdentifier SubnetId { get; set; } + /// Count of vCores belonging to this instance pool. + public int? VCores { get; set; } + /// The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). + public InstancePoolLicenseType? LicenseType { get; set; } + /// The Dns Zone that the managed instance pool is in. + public string DnsZone { get; } + /// Specifies maintenance configuration id to apply to this managed instance. + public ResourceIdentifier MaintenanceConfigurationId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointData.Serialization.cs new file mode 100644 index 000000000000..853bed6308ff --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointData.Serialization.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Sql +{ + public partial class JobPrivateEndpointData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(TargetServerAzureResourceId)) + { + writer.WritePropertyName("targetServerAzureResourceId"u8); + writer.WriteStringValue(TargetServerAzureResourceId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static JobPrivateEndpointData DeserializeJobPrivateEndpointData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional targetServerAzureResourceId = default; + Optional privateEndpointId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"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()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("targetServerAzureResourceId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetServerAzureResourceId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("privateEndpointId"u8)) + { + privateEndpointId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new JobPrivateEndpointData(id, name, type, systemData.Value, targetServerAzureResourceId.Value, privateEndpointId.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointListResult.Serialization.cs new file mode 100644 index 000000000000..48a9218272be --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class JobPrivateEndpointListResult + { + internal static JobPrivateEndpointListResult DeserializeJobPrivateEndpointListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(JobPrivateEndpointData.DeserializeJobPrivateEndpointData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new JobPrivateEndpointListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointListResult.cs new file mode 100644 index 000000000000..b098686f4148 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobPrivateEndpointListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Sql; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of job agent private endpoints. + internal partial class JobPrivateEndpointListResult + { + /// Initializes a new instance of JobPrivateEndpointListResult. + internal JobPrivateEndpointListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of JobPrivateEndpointListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal JobPrivateEndpointListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/InstancePoolsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/InstancePoolsRestOperations.cs index f461a606e1c3..966c5f4a3938 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/InstancePoolsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/InstancePoolsRestOperations.cs @@ -33,10 +33,150 @@ public InstancePoolsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2020-11-01-preview"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } + 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.Sql/instancePools", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of all instance pools in the subscription. + /// The subscription ID that identifies an Azure 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: + { + InstancePoolListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InstancePoolListResult.DeserializeInstancePoolListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of all instance pools in the subscription. + /// The subscription ID that identifies an Azure 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) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InstancePoolListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InstancePoolListResult.DeserializeInstancePoolListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + 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.Sql/instancePools", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of instance pools in the resource group. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// 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: + { + InstancePoolListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InstancePoolListResult.DeserializeInstancePoolListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of instance pools in the resource group. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// 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) + { + 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: + { + InstancePoolListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InstancePoolListResult.DeserializeInstancePoolListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string instancePoolName) { var message = _pipeline.CreateMessage(); @@ -348,90 +488,14 @@ public Response Update(string subscriptionId, string resourceGroupName, string i } } - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) - { - 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.Sql/instancePools", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets a list of instance pools in the resource group. - /// The subscription ID that identifies an Azure subscription. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// 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: - { - InstancePoolListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InstancePoolListResult.DeserializeInstancePoolListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a list of instance pools in the resource group. - /// The subscription ID that identifies an Azure subscription. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// 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) - { - 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: - { - InstancePoolListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InstancePoolListResult.DeserializeInstancePoolListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListRequest(string subscriptionId) + internal HttpMessage CreateListNextPageRequest(string nextLink, 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.Sql/instancePools", false); - uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendRawNextLink(nextLink, false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); @@ -439,15 +503,17 @@ internal HttpMessage CreateListRequest(string subscriptionId) } /// Gets a list of all instance pools in the subscription. + /// The URL to the next page of results. /// The subscription ID that identifies an Azure subscription. /// The cancellation token to use. - /// is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, CancellationToken cancellationToken = default) + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateListRequest(subscriptionId); + using var message = CreateListNextPageRequest(nextLink, subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -464,15 +530,17 @@ public async Task> ListAsync(string subscriptio } /// Gets a list of all instance pools in the subscription. + /// The URL to the next page of results. /// The subscription ID that identifies an Azure subscription. /// The cancellation token to use. - /// is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, CancellationToken cancellationToken = default) + public Response ListNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateListRequest(subscriptionId); + using var message = CreateListNextPageRequest(nextLink, subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -559,73 +627,5 @@ public Response ListByResourceGroupNextPage(string nextL throw new RequestFailedException(message.Response); } } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets a list of all instance pools in the subscription. - /// The URL to the next page of results. - /// The subscription ID that identifies an Azure subscription. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - InstancePoolListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = InstancePoolListResult.DeserializeInstancePoolListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a list of all instance pools in the subscription. - /// The URL to the next page of results. - /// The subscription ID that identifies an Azure subscription. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - InstancePoolListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = InstancePoolListResult.DeserializeInstancePoolListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/JobPrivateEndpointsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/JobPrivateEndpointsRestOperations.cs new file mode 100644 index 000000000000..86195928a6f9 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/JobPrivateEndpointsRestOperations.cs @@ -0,0 +1,474 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#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.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class JobPrivateEndpointsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of JobPrivateEndpointsRestOperations. + /// 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 JobPrivateEndpointsRestOperations(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 ?? "2023-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByAgentRequest(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName) + { + 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.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/jobAgents/", false); + uri.AppendPath(jobAgentName, true); + uri.AppendPath("/privateEndpoints", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of job agent private endpoints. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the job agent. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByAgentAsync(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + + using var message = CreateListByAgentRequest(subscriptionId, resourceGroupName, serverName, jobAgentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + JobPrivateEndpointListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = JobPrivateEndpointListResult.DeserializeJobPrivateEndpointListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of job agent private endpoints. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the job agent. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByAgent(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + + using var message = CreateListByAgentRequest(subscriptionId, resourceGroupName, serverName, jobAgentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + JobPrivateEndpointListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = JobPrivateEndpointListResult.DeserializeJobPrivateEndpointListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName) + { + 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.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/jobAgents/", false); + uri.AppendPath(jobAgentName, true); + uri.AppendPath("/privateEndpoints/", false); + uri.AppendPath(privateEndpointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a private endpoint. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the job agent. + /// The name of the private endpoint to get. + /// 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 serverName, string jobAgentName, string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + JobPrivateEndpointData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = JobPrivateEndpointData.DeserializeJobPrivateEndpointData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((JobPrivateEndpointData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a private endpoint. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the job agent. + /// The name of the private endpoint to get. + /// 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 serverName, string jobAgentName, string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + JobPrivateEndpointData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = JobPrivateEndpointData.DeserializeJobPrivateEndpointData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((JobPrivateEndpointData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName, JobPrivateEndpointData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + 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.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/jobAgents/", false); + uri.AppendPath(jobAgentName, true); + uri.AppendPath("/privateEndpoints/", false); + uri.AppendPath(privateEndpointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a private endpoint. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the job agent. + /// The name of the private endpoint. + /// The requested private endpoint state. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName, JobPrivateEndpointData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates a private endpoint. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the job agent. + /// The name of the private endpoint. + /// The requested private endpoint state. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName, JobPrivateEndpointData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, string privateEndpointName) + { + 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.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/jobAgents/", false); + uri.AppendPath(jobAgentName, true); + uri.AppendPath("/privateEndpoints/", false); + uri.AppendPath(privateEndpointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + _userAgent.Apply(message); + return message; + } + + /// Deletes a private endpoint. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the job agent. + /// The name of the private endpoint to delete. + /// 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 serverName, string jobAgentName, string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName); + 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 a private endpoint. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the job agent. + /// The name of the private endpoint to delete. + /// 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 serverName, string jobAgentName, string privateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + Argument.AssertNotNullOrEmpty(privateEndpointName, nameof(privateEndpointName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, serverName, jobAgentName, privateEndpointName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByAgentNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string serverName, string jobAgentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of job agent private endpoints. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the job agent. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByAgentNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + + using var message = CreateListByAgentNextPageRequest(nextLink, subscriptionId, resourceGroupName, serverName, jobAgentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + JobPrivateEndpointListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = JobPrivateEndpointListResult.DeserializeJobPrivateEndpointListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of job agent private endpoints. + /// The URL to the next page of results. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the job agent. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByAgentNextPage(string nextLink, string subscriptionId, string resourceGroupName, string serverName, string jobAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(serverName, nameof(serverName)); + Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); + + using var message = CreateListByAgentNextPageRequest(nextLink, subscriptionId, resourceGroupName, serverName, jobAgentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + JobPrivateEndpointListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = JobPrivateEndpointListResult.DeserializeJobPrivateEndpointListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentResource.cs index b94026af7618..ce3ed6496e46 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentResource.cs @@ -151,6 +151,59 @@ public virtual Response GetSqlServerJobCredentia return GetSqlServerJobCredentials().Get(credentialName, cancellationToken); } + /// Gets a collection of JobPrivateEndpointResources in the SqlServerJobAgent. + /// An object representing collection of JobPrivateEndpointResources and their operations over a JobPrivateEndpointResource. + public virtual JobPrivateEndpointCollection GetJobPrivateEndpoints() + { + return GetCachedClient(client => new JobPrivateEndpointCollection(client, Id)); + } + + /// + /// Gets a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetJobPrivateEndpointAsync(string privateEndpointName, CancellationToken cancellationToken = default) + { + return await GetJobPrivateEndpoints().GetAsync(privateEndpointName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a private endpoint. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/privateEndpoints/{privateEndpointName} + /// + /// + /// Operation Id + /// JobPrivateEndpoints_Get + /// + /// + /// + /// The name of the private endpoint to get. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetJobPrivateEndpoint(string privateEndpointName, CancellationToken cancellationToken = default) + { + return GetJobPrivateEndpoints().Get(privateEndpointName, cancellationToken); + } + /// Gets a collection of SqlServerJobResources in the SqlServerJobAgent. /// An object representing collection of SqlServerJobResources and their operations over a SqlServerJobResource. public virtual SqlServerJobCollection GetSqlServerJobs() diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md index c29f3445593f..006c5b964df6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md @@ -5,7 +5,7 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml azure-arm: true tag: package-composite-v5 -require: https://github.com/Azure/azure-rest-api-specs/blob/fb1e2c65b2dd52ebb18bb835a3d0f0289875858e/specification/sql/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/sql/resource-manager/readme.md namespace: Azure.ResourceManager.Sql output-folder: $(this-folder)/Generated clear-output-folder: true