diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props index 09e58d02b6c9..f018d734b1ad 100644 --- a/eng/Packages.Data.props +++ b/eng/Packages.Data.props @@ -146,7 +146,7 @@ All should have PrivateAssets="All" set so they don't become package dependencies --> - + diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/autorest.md b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/autorest.md index 6b58d2476539..9d58c732669e 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/autorest.md +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/autorest.md @@ -6,7 +6,7 @@ Run `dotnet build /t:GenerateCode` to generate code. title: FarmBeats input-file: https://github.com/Azure/azure-rest-api-specs/blob/683e3f4849ee1d84629d0d0fa17789e80a9cee08/specification/agfood/data-plane/Microsoft.AgFoodPlatform/preview/2021-03-31-preview/agfood.json namespace: Azure.Verticals.AgriFood.Farming -low-level-client: true +data-plane: true security: AADToken security-scopes: https://farmbeats.azure.net/.default ``` diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/autorest.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/autorest.md index 83c4f9446a2d..d4b31a9b4b67 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/autorest.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/autorest.md @@ -15,7 +15,7 @@ batch: # TODO: Uncomment when we ship authoring support and remove ./ConversationsClientOptions.cs. # - input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/33138867cd88a4a8689feb591a98dda26d96a63e/specification/cognitiveservices/data-plane/Language/preview/2021-07-15-preview/analyzeconversations-authoring.json # add-credentials: true -# low-level-client: true +# data-plane: true modelerfour: lenient-model-deduplication: true diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/autorest.md b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/autorest.md index 0289164bcc0f..57bf67a765de 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/autorest.md +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/src/autorest.md @@ -15,7 +15,7 @@ batch: # TODO: Uncomment when we ship authoring support and remove ./QuestionAnsweringClientOptions.cs. # - input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/34a2c0723155d134311419fd997925ce96b85bec/specification/cognitiveservices/data-plane/Language/stable/2021-10-01/questionanswering-authoring.json # add-credentials: true -# low-level-client: true +# data-plane: true modelerfour: lenient-model-deduplication: true diff --git a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/autorest.md b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/autorest.md index 95ccd948d4c5..34d1816e9b73 100644 --- a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/autorest.md +++ b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/autorest.md @@ -7,7 +7,7 @@ title: ConfidentialLedger namespace: Azure.Security.ConfidentialLedger security: AADToken security-scopes: "https://confidential-ledger.azure.com/.default" -low-level-client: true +data-plane: true input-file: - https://github.com/Azure/azure-rest-api-specs/blob/e34c5f11d61ca17fdc9fd0f70446dd54b94d67f1/specification/confidentialledger/data-plane/Microsoft.ConfidentialLedger/preview/0.1-preview/common.json - https://github.com/Azure/azure-rest-api-specs/blob/e34c5f11d61ca17fdc9fd0f70446dd54b94d67f1/specification/confidentialledger/data-plane/Microsoft.ConfidentialLedger/preview/0.1-preview/confidentialledger.json diff --git a/sdk/purview/Azure.Analytics.Purview.Account/src/autorest.md b/sdk/purview/Azure.Analytics.Purview.Account/src/autorest.md index ac4852da1f30..fd64ef31a0a4 100644 --- a/sdk/purview/Azure.Analytics.Purview.Account/src/autorest.md +++ b/sdk/purview/Azure.Analytics.Purview.Account/src/autorest.md @@ -6,7 +6,7 @@ Run `dotnet build /t:GenerateCode` to generate code. title: PurviewAccount input-file: https://github.com/Azure/azure-rest-api-specs/blob/b2bddfe2e59b5b14e559e0433b6e6d057bcff95d/specification/purview/data-plane/Azure.Analytics.Purview.Account/preview/2019-11-01-preview/account.json namespace: Azure.Analytics.Purview.Account -low-level-client: true +data-plane: true security: AADToken security-scopes: https://purview.azure.net/.default ``` @@ -57,4 +57,4 @@ directive: }; $.operationId = (mappingTable[$.operationId] ?? $.operationId); -``` \ No newline at end of file +``` diff --git a/sdk/purview/Azure.Analytics.Purview.Administration/src/autorest.md b/sdk/purview/Azure.Analytics.Purview.Administration/src/autorest.md index 1798ae5549c5..af8d59fae177 100644 --- a/sdk/purview/Azure.Analytics.Purview.Administration/src/autorest.md +++ b/sdk/purview/Azure.Analytics.Purview.Administration/src/autorest.md @@ -8,7 +8,7 @@ input-file: - https://github.com/Azure/azure-rest-api-specs/blob/b2bddfe2e59b5b14e559e0433b6e6d057bcff95d/specification/purview/data-plane/Azure.Analytics.Purview.Account/preview/2019-11-01-preview/account.json - https://github.com/Azure/azure-rest-api-specs/blob/1424fc4a1f82af852a626c6ab6d1d296b5fe4df1/specification/purview/data-plane/Azure.Analytics.Purview.MetadataPolicies/preview/2021-07-01/purviewMetadataPolicy.json namespace: Azure.Analytics.Purview.Administration -low-level-client: true +data-plane: true modelerfour: lenient-model-deduplication: true security: AADToken diff --git a/sdk/purview/Azure.Analytics.Purview.Catalog/src/autorest.md b/sdk/purview/Azure.Analytics.Purview.Catalog/src/autorest.md index 1b75c135929f..f9b5e77721fb 100644 --- a/sdk/purview/Azure.Analytics.Purview.Catalog/src/autorest.md +++ b/sdk/purview/Azure.Analytics.Purview.Catalog/src/autorest.md @@ -6,7 +6,7 @@ Run `dotnet build /t:GenerateCode` to generate code. title: PurviewCatalog input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/d23ad89e8c3e98c4f941fd9ec3db6ab39951a494/specification/purview/data-plane/Azure.Analytics.Purview.Catalog/preview/2021-05-01-preview/purviewcatalog.json namespace: Azure.Analytics.Purview.Catalog -low-level-client: true +data-plane: true security: AADToken security-scopes: https://purview.azure.net/.default ``` diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/autorest.md b/sdk/purview/Azure.Analytics.Purview.Scanning/src/autorest.md index 435bd4bc405d..e8548c233166 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/autorest.md +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/autorest.md @@ -6,7 +6,7 @@ Run `dotnet build /t:GenerateCode` to generate code. title: PurviewScanningService input-file: https://github.com/Azure/azure-rest-api-specs/blob/1c7df99f6a84335cfd7bf5be8c800d72c1dddbc2/specification/purview/data-plane/Azure.Analytics.Purview.Scanning/preview/2018-12-01-preview/scanningService.json namespace: Azure.Analytics.Purview.Scanning -low-level-client: true +data-plane: true security: AADToken security-scopes: https://purview.azure.net/.default modelerfour: 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 38785a4d4966..bed3f4648375 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 @@ -302,7 +302,10 @@ public partial class DataMaskingPolicy : Azure.ResourceManager.Core.ArmResource protected DataMaskingPolicy() { } public virtual Azure.ResourceManager.Sql.DataMaskingPolicyData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } + public Azure.ResourceManager.Core.ArmResource Parent { get { throw null; } } protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } + public virtual Azure.ResourceManager.Sql.Models.DataMaskingPolicyCreateOrUpdateOperation CreateOrUpdate(Azure.ResourceManager.Sql.DataMaskingPolicyData parameters, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.Sql.DataMaskingPolicyData parameters, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateOrUpdateDataMaskingRule(string dataMaskingRuleName, Azure.ResourceManager.Sql.Models.DataMaskingRule parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateOrUpdateDataMaskingRuleAsync(string dataMaskingRuleName, Azure.ResourceManager.Sql.Models.DataMaskingRule parameters, 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; } @@ -312,19 +315,6 @@ protected DataMaskingPolicy() { } public virtual Azure.Pageable GetDataMaskingRules(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetDataMaskingRulesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class DataMaskingPolicyCollection : Azure.ResourceManager.Core.ArmCollection - { - protected DataMaskingPolicyCollection() { } - protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } - public virtual Azure.Response CheckIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CheckIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.Sql.Models.DataMaskingPolicyCreateOrUpdateOperation CreateOrUpdate(Azure.ResourceManager.Sql.DataMaskingPolicyData parameters, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.Sql.DataMaskingPolicyData parameters, bool waitForCompletion = true, 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.Response GetIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } public partial class DataMaskingPolicyData : Azure.ResourceManager.Models.Resource { public DataMaskingPolicyData() { } @@ -3646,7 +3636,7 @@ protected SqlDatabase() { } public Azure.ResourceManager.Sql.DatabaseSecurityAlertPolicyCollection GetDatabaseSecurityAlertPolicies() { throw null; } public virtual Azure.Pageable GetDatabaseUsages(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetDatabaseUsagesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public Azure.ResourceManager.Sql.DataMaskingPolicyCollection GetDataMaskingPolicies() { throw null; } + public Azure.ResourceManager.Sql.DataMaskingPolicy GetDataMaskingPolicy() { throw null; } public Azure.ResourceManager.Sql.DataWarehouseUserActivitiesCollection GetDataWarehouseUserActivities() { throw null; } public Azure.ResourceManager.Sql.ExtendedDatabaseBlobAuditingPolicyCollection GetExtendedDatabaseBlobAuditingPolicies() { throw null; } public Azure.ResourceManager.Sql.GeoBackupPolicyCollection GetGeoBackupPolicies() { throw null; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataMaskingPolicy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataMaskingPolicy.cs index 74536e62755b..6365ca7bae29 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataMaskingPolicy.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataMaskingPolicy.cs @@ -39,6 +39,7 @@ internal DataMaskingPolicy(ArmResource options, DataMaskingPolicyData resource) { HasData = true; _data = resource; + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _dataMaskingPoliciesRestClient = new DataMaskingPoliciesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); _dataMaskingRulesRestClient = new DataMaskingRulesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); @@ -49,6 +50,7 @@ internal DataMaskingPolicy(ArmResource options, DataMaskingPolicyData resource) /// The identifier of the resource that is the target of operations. internal DataMaskingPolicy(ArmResource options, ResourceIdentifier id) : base(options, id) { + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _dataMaskingPoliciesRestClient = new DataMaskingPoliciesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); _dataMaskingRulesRestClient = new DataMaskingRulesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); @@ -88,6 +90,9 @@ public virtual DataMaskingPolicyData Data } } + /// Gets the parent resource of this resource. + public ArmResource Parent { get; } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName} /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName} /// OperationId: DataMaskingPolicies_Get @@ -150,6 +155,70 @@ public virtual IEnumerable GetAvailableLocations(CancellationToken can return ListAvailableLocations(ResourceType, cancellationToken); } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName} + /// OperationId: DataMaskingPolicies_CreateOrUpdate + /// Creates or updates a database data masking policy. + /// Parameters for creating or updating a data masking policy. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreateOrUpdateAsync(DataMaskingPolicyData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("DataMaskingPolicy.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dataMaskingPoliciesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, parameters, cancellationToken).ConfigureAwait(false); + var operation = new DataMaskingPolicyCreateOrUpdateOperation(this, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName} + /// OperationId: DataMaskingPolicies_CreateOrUpdate + /// Creates or updates a database data masking policy. + /// Parameters for creating or updating a data masking policy. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual DataMaskingPolicyCreateOrUpdateOperation CreateOrUpdate(DataMaskingPolicyData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("DataMaskingPolicy.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dataMaskingPoliciesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, parameters, cancellationToken); + var operation = new DataMaskingPolicyCreateOrUpdateOperation(this, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName} /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName} /// OperationId: DataMaskingRules_CreateOrUpdate diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataMaskingPolicyCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataMaskingPolicyCollection.cs deleted file mode 100644 index f2fb62baaba7..000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataMaskingPolicyCollection.cs +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Sql.Models; - -namespace Azure.ResourceManager.Sql -{ - /// A class representing collection of DataMaskingPolicy and their operations over its parent. - public partial class DataMaskingPolicyCollection : ArmCollection - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly DataMaskingPoliciesRestOperations _dataMaskingPoliciesRestClient; - - /// Initializes a new instance of the class for mocking. - protected DataMaskingPolicyCollection() - { - } - - /// Initializes a new instance of DataMaskingPolicyCollection class. - /// The resource representing the parent resource. - internal DataMaskingPolicyCollection(ArmResource parent) : base(parent) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _dataMaskingPoliciesRestClient = new DataMaskingPoliciesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => SqlDatabase.ResourceType; - - // Collection level operations. - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName} - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName} - /// OperationId: DataMaskingPolicies_CreateOrUpdate - /// Creates or updates a database data masking policy. - /// Parameters for creating or updating a data masking policy. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual DataMaskingPolicyCreateOrUpdateOperation CreateOrUpdate(DataMaskingPolicyData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var scope = _clientDiagnostics.CreateScope("DataMaskingPolicyCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _dataMaskingPoliciesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters, cancellationToken); - var operation = new DataMaskingPolicyCreateOrUpdateOperation(Parent, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName} - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName} - /// OperationId: DataMaskingPolicies_CreateOrUpdate - /// Creates or updates a database data masking policy. - /// Parameters for creating or updating a data masking policy. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task CreateOrUpdateAsync(DataMaskingPolicyData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var scope = _clientDiagnostics.CreateScope("DataMaskingPolicyCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _dataMaskingPoliciesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, parameters, cancellationToken).ConfigureAwait(false); - var operation = new DataMaskingPolicyCreateOrUpdateOperation(Parent, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName} - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName} - /// OperationId: DataMaskingPolicies_Get - /// Gets a database data masking policy. - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("DataMaskingPolicyCollection.Get"); - scope.Start(); - try - { - var response = _dataMaskingPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new DataMaskingPolicy(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName} - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName} - /// OperationId: DataMaskingPolicies_Get - /// Gets a database data masking policy. - /// The cancellation token to use. - public async virtual Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("DataMaskingPolicyCollection.Get"); - scope.Start(); - try - { - var response = await _dataMaskingPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new DataMaskingPolicy(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response GetIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("DataMaskingPolicyCollection.GetIfExists"); - scope.Start(); - try - { - var response = _dataMaskingPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new DataMaskingPolicy(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public async virtual Task> GetIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("DataMaskingPolicyCollection.GetIfExistsAsync"); - scope.Start(); - try - { - var response = await _dataMaskingPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new DataMaskingPolicy(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response CheckIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("DataMaskingPolicyCollection.CheckIfExists"); - scope.Start(); - try - { - var response = GetIfExists(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. - /// The cancellation token to use. - public async virtual Task> CheckIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("DataMaskingPolicyCollection.CheckIfExistsAsync"); - scope.Start(); - try - { - var response = await GetIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - // Builders. - // public ArmBuilder Construct() { } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabase.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabase.cs index debfcb636da9..2df41dc1a231 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabase.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabase.cs @@ -1768,11 +1768,11 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) #region DataMaskingPolicy - /// Gets a collection of DataMaskingPolicies in the SqlDatabase. - /// An object representing collection of DataMaskingPolicies and their operations over a SqlDatabase. - public DataMaskingPolicyCollection GetDataMaskingPolicies() + /// Gets an object representing a DataMaskingPolicy along with the instance operations that can be performed on it in the SqlDatabase. + /// Returns a object. + public DataMaskingPolicy GetDataMaskingPolicy() { - return new DataMaskingPolicyCollection(this); + return new DataMaskingPolicy(this, new ResourceIdentifier(Id.ToString() + "/dataMaskingPolicies/Default")); } #endregion diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/autorest.md b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/autorest.md index 625b9205d99f..598053fd3638 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/autorest.md +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/autorest.md @@ -11,7 +11,7 @@ require: - https://github.com/Azure/azure-rest-api-specs/blob/37c4ff1612668f5acec62dea729ca3a66b591d7f/specification/synapse/data-plane/readme.md namespace: Azure.Analytics.Synapse.AccessControl public-clients: true -low-level-client: true +data-plane: true security: AADToken security-scopes: https://dev.azuresynapse.net/.default ``` diff --git a/sdk/template-dpg/Azure.Template.Generated/src/autorest.md b/sdk/template-dpg/Azure.Template.Generated/src/autorest.md index 9326b5817047..46d78d0c6327 100644 --- a/sdk/template-dpg/Azure.Template.Generated/src/autorest.md +++ b/sdk/template-dpg/Azure.Template.Generated/src/autorest.md @@ -10,7 +10,7 @@ input-file: - $(this-folder)/swagger/swagger.json namespace: Azure.Template.Generated public-clients: true -low-level-client: true +data-plane: true security: AADToken security-scopes: https://dev.azuresdkgenerated.net/.default ``` diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/autorest.md b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/autorest.md index 9c8e63bb9d97..622b0b805514 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/autorest.md +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/autorest.md @@ -10,7 +10,7 @@ Run `dotnet build /t:GenerateCode` to generate code. title: WebPubSubServiceClient input-file: - https://github.com/Azure/azure-rest-api-specs/blob/39c7d63c21b9a29efe3907d9b949d1c77b021907/specification/webpubsub/data-plane/WebPubSub/stable/2021-10-01/webpubsub.json -low-level-client: true +data-plane: true credential-types: AzureKeyCredential credential-header-name: Ocp-Apim-Subscription-Key ``` diff --git a/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.netstandard2.0.cs b/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.netstandard2.0.cs index 9af87c5ff4aa..a89be94ff5b6 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.netstandard2.0.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/api/Azure.ResourceManager.AppService.netstandard2.0.cs @@ -318,7 +318,7 @@ protected AppServicePlan() { } public virtual System.Threading.Tasks.Task> GetAvailableLocationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response> GetCapabilities(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task>> GetCapabilitiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public Azure.ResourceManager.AppService.HybridConnectionLimitsCollection GetHybridConnectionLimits() { throw null; } + public Azure.ResourceManager.AppService.HybridConnectionLimits GetHybridConnectionLimits() { throw null; } public virtual Azure.Pageable GetHybridConnections(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetHybridConnectionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public Azure.ResourceManager.AppService.ServerfarmHybridConnectionNamespaceRelayCollection GetServerfarmHybridConnectionNamespaceRelays() { throw null; } @@ -972,23 +972,13 @@ public partial class HybridConnectionLimits : Azure.ResourceManager.Core.ArmReso protected HybridConnectionLimits() { } public virtual Azure.ResourceManager.AppService.HybridConnectionLimitsData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } + public Azure.ResourceManager.Core.ArmResource Parent { get { throw null; } } protected override Azure.ResourceManager.ResourceType ValidResourceType { get { 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 System.Collections.Generic.IEnumerable GetAvailableLocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAvailableLocationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class HybridConnectionLimitsCollection : Azure.ResourceManager.Core.ArmCollection - { - protected HybridConnectionLimitsCollection() { } - protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } - public virtual Azure.Response CheckIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CheckIfExistsAsync(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.Response GetIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } public partial class HybridConnectionLimitsData : Azure.ResourceManager.AppService.Models.ProxyOnlyResource { public HybridConnectionLimitsData() { } @@ -1055,23 +1045,13 @@ public partial class MigrateMySqlStatus : Azure.ResourceManager.Core.ArmResource protected MigrateMySqlStatus() { } public virtual Azure.ResourceManager.AppService.MigrateMySqlStatusData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } + public Azure.ResourceManager.Core.ArmResource Parent { get { throw null; } } protected override Azure.ResourceManager.ResourceType ValidResourceType { get { 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 System.Collections.Generic.IEnumerable GetAvailableLocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAvailableLocationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class MigrateMySqlStatusCollection : Azure.ResourceManager.Core.ArmCollection - { - protected MigrateMySqlStatusCollection() { } - protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } - public virtual Azure.Response CheckIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CheckIfExistsAsync(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.Response GetIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } public partial class MigrateMySqlStatusData : Azure.ResourceManager.AppService.Models.ProxyOnlyResource { public MigrateMySqlStatusData() { } @@ -1807,7 +1787,10 @@ public partial class SiteExtension : Azure.ResourceManager.Core.ArmResource protected SiteExtension() { } public virtual Azure.ResourceManager.AppService.MSDeployStatusData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } + public Azure.ResourceManager.Core.ArmResource Parent { get { throw null; } } protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } + public virtual Azure.ResourceManager.AppService.Models.WebAppCreateMSDeployOperationOperation CreateOrUpdate(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, 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 System.Collections.Generic.IEnumerable GetAvailableLocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -1815,19 +1798,6 @@ protected SiteExtension() { } public virtual Azure.Response GetMSDeployLog(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetMSDeployLogAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class SiteExtensionCollection : Azure.ResourceManager.Core.ArmCollection - { - protected SiteExtensionCollection() { } - protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } - public virtual Azure.Response CheckIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CheckIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.AppService.Models.WebAppCreateMSDeployOperationOperation CreateOrUpdate(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, 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.Response GetIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } public partial class SiteExtensionInfoData : Azure.ResourceManager.AppService.Models.ProxyOnlyResource { public SiteExtensionInfoData() { } @@ -1993,7 +1963,7 @@ protected SiteInstance() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Collections.Generic.IEnumerable GetAvailableLocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAvailableLocationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public Azure.ResourceManager.AppService.SiteInstanceExtensionCollection GetSiteInstanceExtensions() { throw null; } + public Azure.ResourceManager.AppService.SiteInstanceExtension GetSiteInstanceExtension() { throw null; } public Azure.ResourceManager.AppService.SiteInstanceProcessCollection GetSiteInstanceProcesses() { throw null; } } public partial class SiteInstanceCollection : Azure.ResourceManager.Core.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable @@ -2018,7 +1988,10 @@ public partial class SiteInstanceExtension : Azure.ResourceManager.Core.ArmResou protected SiteInstanceExtension() { } public virtual Azure.ResourceManager.AppService.MSDeployStatusData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } + public Azure.ResourceManager.Core.ArmResource Parent { get { throw null; } } protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } + public virtual Azure.ResourceManager.AppService.Models.WebAppCreateInstanceMSDeployOperationOperation CreateOrUpdate(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, 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 System.Collections.Generic.IEnumerable GetAvailableLocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -2026,19 +1999,6 @@ protected SiteInstanceExtension() { } public virtual Azure.Response GetInstanceMSDeployLog(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetInstanceMSDeployLogAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class SiteInstanceExtensionCollection : Azure.ResourceManager.Core.ArmCollection - { - protected SiteInstanceExtensionCollection() { } - protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } - public virtual Azure.Response CheckIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CheckIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.AppService.Models.WebAppCreateInstanceMSDeployOperationOperation CreateOrUpdate(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, 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.Response GetIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } public partial class SiteInstanceProcess : Azure.ResourceManager.Core.ArmResource { public static readonly Azure.ResourceManager.ResourceType ResourceType; @@ -2116,7 +2076,10 @@ public partial class SiteNetworkConfig : Azure.ResourceManager.Core.ArmResource protected SiteNetworkConfig() { } public virtual Azure.ResourceManager.AppService.SwiftVirtualNetworkData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } + public Azure.ResourceManager.Core.ArmResource Parent { get { throw null; } } protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } + public virtual Azure.ResourceManager.AppService.Models.WebAppCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckOperation CreateOrUpdate(Azure.ResourceManager.AppService.SwiftVirtualNetworkData connectionEnvelope, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.AppService.SwiftVirtualNetworkData connectionEnvelope, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.AppService.Models.WebAppDeleteSwiftVirtualNetworkOperation Delete(bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(bool waitForCompletion = true, 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; } @@ -2126,19 +2089,6 @@ protected SiteNetworkConfig() { } public virtual Azure.Response Update(Azure.ResourceManager.AppService.SwiftVirtualNetworkData connectionEnvelope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.AppService.SwiftVirtualNetworkData connectionEnvelope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class SiteNetworkConfigCollection : Azure.ResourceManager.Core.ArmCollection - { - protected SiteNetworkConfigCollection() { } - protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } - public virtual Azure.Response CheckIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CheckIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.AppService.Models.WebAppCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckOperation CreateOrUpdate(Azure.ResourceManager.AppService.SwiftVirtualNetworkData connectionEnvelope, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.AppService.SwiftVirtualNetworkData connectionEnvelope, bool waitForCompletion = true, 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.Response GetIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } public partial class SitePremierAddon : Azure.ResourceManager.Core.ArmResource { public static readonly Azure.ResourceManager.ResourceType ResourceType; @@ -2433,7 +2383,7 @@ protected SiteSlot() { } public virtual System.Threading.Tasks.Task> GetHybridConnectionsSlotAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetMetadataSlot(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetMetadataSlotAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public Azure.ResourceManager.AppService.MigrateMySqlStatusCollection GetMigrateMySqlStatuses() { throw null; } + public Azure.ResourceManager.AppService.MigrateMySqlStatus GetMigrateMySqlStatus() { throw null; } public Azure.ResourceManager.AppService.NetworkFeaturesCollection GetNetworkFeatures() { throw null; } public virtual Azure.Response GetNetworkTraceOperationSlot(string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetNetworkTraceOperationSlotAsync(string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -2473,7 +2423,7 @@ protected SiteSlot() { } public Azure.ResourceManager.AppService.SiteSlotDetectorCollection GetSiteSlotDetectors() { throw null; } public Azure.ResourceManager.AppService.SiteSlotDiagnosticCollection GetSiteSlotDiagnostics() { throw null; } public Azure.ResourceManager.AppService.SiteSlotDomainOwnershipIdentifierCollection GetSiteSlotDomainOwnershipIdentifiers() { throw null; } - public Azure.ResourceManager.AppService.SiteSlotExtensionCollection GetSiteSlotExtensions() { throw null; } + public Azure.ResourceManager.AppService.SiteSlotExtension GetSiteSlotExtension() { throw null; } public Azure.ResourceManager.AppService.SiteSlotFunctionCollection GetSiteSlotFunctions() { throw null; } public Azure.ResourceManager.AppService.SiteSlotHostNameBindingCollection GetSiteSlotHostNameBindings() { throw null; } public Azure.ResourceManager.AppService.SiteSlotHybridConnectionNamespaceRelayCollection GetSiteSlotHybridConnectionNamespaceRelays() { throw null; } @@ -2481,13 +2431,13 @@ protected SiteSlot() { } public Azure.ResourceManager.AppService.SiteSlotInstanceCollection GetSiteSlotInstances() { throw null; } public Azure.ResourceManager.AppService.SiteSlotNetworkConfig GetSiteSlotNetworkConfig() { throw null; } public Azure.ResourceManager.AppService.SiteSlotPremierAddOnCollection GetSiteSlotPremierAddOns() { throw null; } - public Azure.ResourceManager.AppService.SiteSlotPrivateAccessCollection GetSiteSlotPrivateAccesses() { throw null; } + public Azure.ResourceManager.AppService.SiteSlotPrivateAccess GetSiteSlotPrivateAccess() { throw null; } public Azure.ResourceManager.AppService.SiteSlotPrivateEndpointConnectionCollection GetSiteSlotPrivateEndpointConnections() { throw null; } public Azure.ResourceManager.AppService.SiteSlotProcessCollection GetSiteSlotProcesses() { throw null; } public Azure.ResourceManager.AppService.SiteSlotPublicCertificateCollection GetSiteSlotPublicCertificates() { throw null; } public Azure.ResourceManager.AppService.SiteSlotResourceHealthMetadata GetSiteSlotResourceHealthMetadata() { throw null; } public Azure.ResourceManager.AppService.SiteSlotSiteextensionCollection GetSiteSlotSiteextensions() { throw null; } - public Azure.ResourceManager.AppService.SiteSlotSourcecontrolCollection GetSiteSlotSourcecontrols() { throw null; } + public Azure.ResourceManager.AppService.SiteSlotSourcecontrol GetSiteSlotSourcecontrol() { throw null; } public Azure.ResourceManager.AppService.SiteSlotVirtualNetworkConnectionCollection GetSiteSlotVirtualNetworkConnections() { throw null; } public Azure.ResourceManager.AppService.SiteSlotWebJobCollection GetSiteSlotWebJobs() { throw null; } public Azure.ResourceManager.AppService.SiteTriggeredwebJobCollection GetSiteTriggeredwebJobs() { throw null; } @@ -2982,7 +2932,10 @@ public partial class SiteSlotExtension : Azure.ResourceManager.Core.ArmResource protected SiteSlotExtension() { } public virtual Azure.ResourceManager.AppService.MSDeployStatusData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } + public Azure.ResourceManager.Core.ArmResource Parent { get { throw null; } } protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } + public virtual Azure.ResourceManager.AppService.Models.WebAppCreateMSDeployOperationSlotOperation CreateOrUpdate(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, 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 System.Collections.Generic.IEnumerable GetAvailableLocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -2990,19 +2943,6 @@ protected SiteSlotExtension() { } public virtual Azure.Response GetMSDeployLogSlot(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetMSDeployLogSlotAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class SiteSlotExtensionCollection : Azure.ResourceManager.Core.ArmCollection - { - protected SiteSlotExtensionCollection() { } - protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } - public virtual Azure.Response CheckIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CheckIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.AppService.Models.WebAppCreateMSDeployOperationSlotOperation CreateOrUpdate(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, 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.Response GetIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } public partial class SiteSlotFunction : Azure.ResourceManager.Core.ArmResource { public static readonly Azure.ResourceManager.ResourceType ResourceType; @@ -3144,7 +3084,7 @@ protected SiteSlotInstance() { } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Collections.Generic.IEnumerable GetAvailableLocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAvailableLocationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public Azure.ResourceManager.AppService.SiteSlotInstanceExtensionCollection GetSiteSlotInstanceExtensions() { throw null; } + public Azure.ResourceManager.AppService.SiteSlotInstanceExtension GetSiteSlotInstanceExtension() { throw null; } public Azure.ResourceManager.AppService.SiteSlotInstanceProcessCollection GetSiteSlotInstanceProcesses() { throw null; } } public partial class SiteSlotInstanceCollection : Azure.ResourceManager.Core.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable @@ -3169,7 +3109,10 @@ public partial class SiteSlotInstanceExtension : Azure.ResourceManager.Core.ArmR protected SiteSlotInstanceExtension() { } public virtual Azure.ResourceManager.AppService.MSDeployStatusData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } + public Azure.ResourceManager.Core.ArmResource Parent { get { throw null; } } protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } + public virtual Azure.ResourceManager.AppService.Models.WebAppCreateInstanceMSDeployOperationSlotOperation CreateOrUpdate(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, 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 System.Collections.Generic.IEnumerable GetAvailableLocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -3177,19 +3120,6 @@ protected SiteSlotInstanceExtension() { } public virtual Azure.Response GetInstanceMSDeployLogSlot(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetInstanceMSDeployLogSlotAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class SiteSlotInstanceExtensionCollection : Azure.ResourceManager.Core.ArmCollection - { - protected SiteSlotInstanceExtensionCollection() { } - protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } - public virtual Azure.Response CheckIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CheckIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.AppService.Models.WebAppCreateInstanceMSDeployOperationSlotOperation CreateOrUpdate(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.AppService.Models.MsDeploy msDeploy, bool waitForCompletion = true, 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.Response GetIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } public partial class SiteSlotInstanceProcess : Azure.ResourceManager.Core.ArmResource { public static readonly Azure.ResourceManager.ResourceType ResourceType; @@ -3307,24 +3237,14 @@ public partial class SiteSlotPrivateAccess : Azure.ResourceManager.Core.ArmResou protected SiteSlotPrivateAccess() { } public virtual Azure.ResourceManager.AppService.PrivateAccessData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } + public Azure.ResourceManager.Core.ArmResource Parent { get { throw null; } } protected override Azure.ResourceManager.ResourceType ValidResourceType { get { 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 System.Collections.Generic.IEnumerable GetAvailableLocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAvailableLocationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } - public partial class SiteSlotPrivateAccessCollection : Azure.ResourceManager.Core.ArmCollection - { - protected SiteSlotPrivateAccessCollection() { } - protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } - public virtual Azure.Response CheckIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CheckIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.AppService.Models.WebAppPutPrivateAccessVnetSlotOperation CreateOrUpdate(Azure.ResourceManager.AppService.PrivateAccessData access, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.AppService.PrivateAccessData access, bool waitForCompletion = true, 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.Response GetIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Collections.Generic.IEnumerable GetAvailableLocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAvailableLocationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class SiteSlotPrivateEndpointConnection : Azure.ResourceManager.Core.ArmResource { @@ -3504,7 +3424,10 @@ public partial class SiteSlotSourcecontrol : Azure.ResourceManager.Core.ArmResou protected SiteSlotSourcecontrol() { } public virtual Azure.ResourceManager.AppService.SiteSourceControlData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } + public Azure.ResourceManager.Core.ArmResource Parent { get { throw null; } } protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } + public virtual Azure.ResourceManager.AppService.Models.WebAppCreateOrUpdateSourceControlSlotOperation CreateOrUpdate(Azure.ResourceManager.AppService.SiteSourceControlData siteSourceControl, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.AppService.SiteSourceControlData siteSourceControl, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.AppService.Models.WebAppDeleteSourceControlSlotOperation Delete(string additionalFlags = null, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string additionalFlags = null, bool waitForCompletion = true, 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; } @@ -3514,19 +3437,6 @@ protected SiteSlotSourcecontrol() { } public virtual Azure.Response Update(Azure.ResourceManager.AppService.SiteSourceControlData siteSourceControl, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.AppService.SiteSourceControlData siteSourceControl, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class SiteSlotSourcecontrolCollection : Azure.ResourceManager.Core.ArmCollection - { - protected SiteSlotSourcecontrolCollection() { } - protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } - public virtual Azure.Response CheckIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CheckIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.AppService.Models.WebAppCreateOrUpdateSourceControlSlotOperation CreateOrUpdate(Azure.ResourceManager.AppService.SiteSourceControlData siteSourceControl, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.AppService.SiteSourceControlData siteSourceControl, bool waitForCompletion = true, 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.Response GetIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } public partial class SiteSlotTriggeredWebJob : Azure.ResourceManager.Core.ArmResource { public static readonly Azure.ResourceManager.ResourceType ResourceType; @@ -4310,7 +4220,7 @@ public static partial class TenantExtensions public static Azure.Pageable GetOperationsProviders(this Azure.ResourceManager.Resources.Tenant tenant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetOperationsProvidersAsync(this Azure.ResourceManager.Resources.Tenant tenant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.AppService.SourceControlCollection GetSourceControls(this Azure.ResourceManager.Resources.Tenant tenant) { throw null; } - public static Azure.ResourceManager.AppService.UserCollection GetUsers(this Azure.ResourceManager.Resources.Tenant tenant) { throw null; } + public static Azure.ResourceManager.AppService.User GetUser(this Azure.ResourceManager.Resources.Tenant tenant) { throw null; } public static Azure.Pageable GetWebAppStacksForLocationProviders(this Azure.ResourceManager.Resources.Tenant tenant, string location, Azure.ResourceManager.AppService.Models.Enum12? stackOsType = default(Azure.ResourceManager.AppService.Models.Enum12?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetWebAppStacksForLocationProvidersAsync(this Azure.ResourceManager.Resources.Tenant tenant, string location, Azure.ResourceManager.AppService.Models.Enum12? stackOsType = default(Azure.ResourceManager.AppService.Models.Enum12?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Pageable GetWebAppStacksProviders(this Azure.ResourceManager.Resources.Tenant tenant, Azure.ResourceManager.AppService.Models.Enum13? stackOsType = default(Azure.ResourceManager.AppService.Models.Enum13?), Azure.ResourceManager.AppService.Models.StackOsType? stackOsType1 = default(Azure.ResourceManager.AppService.Models.StackOsType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -4378,24 +4288,14 @@ public partial class User : Azure.ResourceManager.Core.ArmResource protected User() { } public virtual Azure.ResourceManager.AppService.UserData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } + public Azure.ResourceManager.Core.ArmResource Parent { get { throw null; } } protected override Azure.ResourceManager.ResourceType ValidResourceType { get { 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 System.Collections.Generic.IEnumerable GetAvailableLocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAvailableLocationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } - public partial class UserCollection : Azure.ResourceManager.Core.ArmCollection - { - protected UserCollection() { } - protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } - public virtual Azure.Response CheckIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CheckIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.AppService.Models.WebSiteManagementUpdatePublishingUserOperation CreateOrUpdate(Azure.ResourceManager.AppService.UserData userDetails, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.ResourceManager.AppService.UserData userDetails, bool waitForCompletion = true, 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.Response GetIfExists(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Collections.Generic.IEnumerable GetAvailableLocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAvailableLocationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class UserData : Azure.ResourceManager.AppService.Models.ProxyOnlyResource { @@ -4531,13 +4431,13 @@ protected WebSite() { } public Azure.ResourceManager.AppService.SiteDetectorCollection GetSiteDetectors() { throw null; } public Azure.ResourceManager.AppService.SiteDiagnosticCollection GetSiteDiagnostics() { throw null; } public Azure.ResourceManager.AppService.SiteDomainOwnershipIdentifierCollection GetSiteDomainOwnershipIdentifiers() { throw null; } - public Azure.ResourceManager.AppService.SiteExtensionCollection GetSiteExtensions() { throw null; } + public Azure.ResourceManager.AppService.SiteExtension GetSiteExtension() { throw null; } public Azure.ResourceManager.AppService.SiteFunctionCollection GetSiteFunctions() { throw null; } public Azure.ResourceManager.AppService.SiteHostNameBindingCollection GetSiteHostNameBindings() { throw null; } public Azure.ResourceManager.AppService.SiteHybridConnectionNamespaceRelayCollection GetSiteHybridConnectionNamespaceRelays() { throw null; } public Azure.ResourceManager.AppService.SiteHybridConnectionCollection GetSiteHybridConnections() { throw null; } public Azure.ResourceManager.AppService.SiteInstanceCollection GetSiteInstances() { throw null; } - public Azure.ResourceManager.AppService.SiteNetworkConfigCollection GetSiteNetworkConfigs() { throw null; } + public Azure.ResourceManager.AppService.SiteNetworkConfig GetSiteNetworkConfig() { throw null; } public virtual Azure.Response GetSitePhpErrorLogFlag(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetSitePhpErrorLogFlagAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public Azure.ResourceManager.AppService.SitePremierAddonCollection GetSitePremierAddons() { throw null; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlan.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlan.cs index 1ebba5edf316..93ac298c2f68 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlan.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlan.cs @@ -702,11 +702,11 @@ public ServerfarmHybridConnectionNamespaceRelayCollection GetServerfarmHybridCon #region HybridConnectionLimits - /// Gets a collection of HybridConnectionLimits in the AppServicePlan. - /// An object representing collection of HybridConnectionLimits and their operations over a AppServicePlan. - public HybridConnectionLimitsCollection GetHybridConnectionLimits() + /// Gets an object representing a HybridConnectionLimits along with the instance operations that can be performed on it in the AppServicePlan. + /// Returns a object. + public HybridConnectionLimits GetHybridConnectionLimits() { - return new HybridConnectionLimitsCollection(this); + return new HybridConnectionLimits(this, new ResourceIdentifier(Id.ToString() + "/hybridConnectionPlanLimits/limit")); } #endregion diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/TenantExtensions.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/TenantExtensions.cs index da758023c7b1..c5b8cb99db7e 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/TenantExtensions.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/TenantExtensions.cs @@ -21,12 +21,12 @@ namespace Azure.ResourceManager.AppService public static partial class TenantExtensions { #region User - /// Gets an object representing a UserCollection along with the instance operations that can be performed on it. + /// Gets an object representing a User along with the instance operations that can be performed on it. /// The instance the method will execute against. - /// Returns a object. - public static UserCollection GetUsers(this Tenant tenant) + /// Returns a object. + public static User GetUser(this Tenant tenant) { - return new UserCollection(tenant); + return new User(tenant, new ResourceIdentifier(tenant.Id + "/providers/Microsoft.Web/publishingUsers/web")); } #endregion diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HybridConnectionLimits.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HybridConnectionLimits.cs index 9ea235ec4635..af5ef809860b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HybridConnectionLimits.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HybridConnectionLimits.cs @@ -37,6 +37,7 @@ internal HybridConnectionLimits(ArmResource options, HybridConnectionLimitsData { HasData = true; _data = resource; + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _appServicePlansRestClient = new AppServicePlansRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -46,6 +47,7 @@ internal HybridConnectionLimits(ArmResource options, HybridConnectionLimitsData /// The identifier of the resource that is the target of operations. internal HybridConnectionLimits(ArmResource options, ResourceIdentifier id) : base(options, id) { + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _appServicePlansRestClient = new AppServicePlansRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -83,6 +85,9 @@ public virtual HybridConnectionLimitsData Data } } + /// Gets the parent resource of this resource. + public ArmResource Parent { get; } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit /// OperationId: AppServicePlans_GetHybridConnectionPlanLimit diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HybridConnectionLimitsCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HybridConnectionLimitsCollection.cs deleted file mode 100644 index 2e20395698c6..000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HybridConnectionLimitsCollection.cs +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Core; - -namespace Azure.ResourceManager.AppService -{ - /// A class representing collection of HybridConnectionLimits and their operations over its parent. - public partial class HybridConnectionLimitsCollection : ArmCollection - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly AppServicePlansRestOperations _appServicePlansRestClient; - - /// Initializes a new instance of the class for mocking. - protected HybridConnectionLimitsCollection() - { - } - - /// Initializes a new instance of HybridConnectionLimitsCollection class. - /// The resource representing the parent resource. - internal HybridConnectionLimitsCollection(ArmResource parent) : base(parent) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _appServicePlansRestClient = new AppServicePlansRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => AppServicePlan.ResourceType; - - // Collection level operations. - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name} - /// OperationId: AppServicePlans_GetHybridConnectionPlanLimit - /// Description for Get the maximum number of Hybrid Connections allowed in an App Service plan. - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("HybridConnectionLimitsCollection.Get"); - scope.Start(); - try - { - var response = _appServicePlansRestClient.GetHybridConnectionPlanLimit(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - if (response.Value == null) - throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new HybridConnectionLimits(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name} - /// OperationId: AppServicePlans_GetHybridConnectionPlanLimit - /// Description for Get the maximum number of Hybrid Connections allowed in an App Service plan. - /// The cancellation token to use. - public async virtual Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("HybridConnectionLimitsCollection.Get"); - scope.Start(); - try - { - var response = await _appServicePlansRestClient.GetHybridConnectionPlanLimitAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new HybridConnectionLimits(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response GetIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("HybridConnectionLimitsCollection.GetIfExists"); - scope.Start(); - try - { - var response = _appServicePlansRestClient.GetHybridConnectionPlanLimit(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new HybridConnectionLimits(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public async virtual Task> GetIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("HybridConnectionLimitsCollection.GetIfExistsAsync"); - scope.Start(); - try - { - var response = await _appServicePlansRestClient.GetHybridConnectionPlanLimitAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new HybridConnectionLimits(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response CheckIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("HybridConnectionLimitsCollection.CheckIfExists"); - scope.Start(); - try - { - var response = GetIfExists(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. - /// The cancellation token to use. - public async virtual Task> CheckIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("HybridConnectionLimitsCollection.CheckIfExistsAsync"); - scope.Start(); - try - { - var response = await GetIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - // Builders. - // public ArmBuilder Construct() { } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/MigrateMySqlStatus.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/MigrateMySqlStatus.cs index 3252660d6328..c43ec3bb9e4c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/MigrateMySqlStatus.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/MigrateMySqlStatus.cs @@ -37,6 +37,7 @@ internal MigrateMySqlStatus(ArmResource options, MigrateMySqlStatusData resource { HasData = true; _data = resource; + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -46,6 +47,7 @@ internal MigrateMySqlStatus(ArmResource options, MigrateMySqlStatusData resource /// The identifier of the resource that is the target of operations. internal MigrateMySqlStatus(ArmResource options, ResourceIdentifier id) : base(options, id) { + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -83,6 +85,9 @@ public virtual MigrateMySqlStatusData Data } } + /// Gets the parent resource of this resource. + public ArmResource Parent { get; } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status /// OperationId: WebApps_GetMigrateMySqlStatusSlot diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/MigrateMySqlStatusCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/MigrateMySqlStatusCollection.cs deleted file mode 100644 index b20bee431c6c..000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/MigrateMySqlStatusCollection.cs +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Core; - -namespace Azure.ResourceManager.AppService -{ - /// A class representing collection of MigrateMySqlStatus and their operations over its parent. - public partial class MigrateMySqlStatusCollection : ArmCollection - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly WebAppsRestOperations _webAppsRestClient; - - /// Initializes a new instance of the class for mocking. - protected MigrateMySqlStatusCollection() - { - } - - /// Initializes a new instance of MigrateMySqlStatusCollection class. - /// The resource representing the parent resource. - internal MigrateMySqlStatusCollection(ArmResource parent) : base(parent) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => SiteSlot.ResourceType; - - // Collection level operations. - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} - /// OperationId: WebApps_GetMigrateMySqlStatusSlot - /// Description for Returns the status of MySql in app migration, if one is active, and whether or not MySql in app is enabled. - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("MigrateMySqlStatusCollection.Get"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetMigrateMySqlStatusSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new MigrateMySqlStatus(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/migratemysql/status - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} - /// OperationId: WebApps_GetMigrateMySqlStatusSlot - /// Description for Returns the status of MySql in app migration, if one is active, and whether or not MySql in app is enabled. - /// The cancellation token to use. - public async virtual Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("MigrateMySqlStatusCollection.Get"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetMigrateMySqlStatusSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new MigrateMySqlStatus(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response GetIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("MigrateMySqlStatusCollection.GetIfExists"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetMigrateMySqlStatusSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new MigrateMySqlStatus(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public async virtual Task> GetIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("MigrateMySqlStatusCollection.GetIfExistsAsync"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetMigrateMySqlStatusSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new MigrateMySqlStatus(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response CheckIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("MigrateMySqlStatusCollection.CheckIfExists"); - scope.Start(); - try - { - var response = GetIfExists(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. - /// The cancellation token to use. - public async virtual Task> CheckIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("MigrateMySqlStatusCollection.CheckIfExistsAsync"); - scope.Start(); - try - { - var response = await GetIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - // Builders. - // public ArmBuilder Construct() { } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceGithubToken.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceGithubToken.Serialization.cs new file mode 100644 index 000000000000..1c62e0a3d0ca --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceGithubToken.Serialization.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class AppServiceGithubToken + { + internal static AppServiceGithubToken DeserializeAppServiceGithubToken(JsonElement element) + { + Optional accessToken = default; + Optional scope = default; + Optional tokenType = default; + Optional gotToken = default; + Optional errorMessage = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("accessToken")) + { + accessToken = property.Value.GetString(); + continue; + } + if (property.NameEquals("scope")) + { + scope = property.Value.GetString(); + continue; + } + if (property.NameEquals("tokenType")) + { + tokenType = property.Value.GetString(); + continue; + } + if (property.NameEquals("gotToken")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + gotToken = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("errorMessage")) + { + errorMessage = property.Value.GetString(); + continue; + } + } + return new AppServiceGithubToken(accessToken.Value, scope.Value, tokenType.Value, Optional.ToNullable(gotToken), errorMessage.Value); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceGithubToken.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceGithubToken.cs new file mode 100644 index 000000000000..8a2f6643904d --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceGithubToken.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.AppService.Models +{ + /// Github access token for Appservice CLI github integration. + public partial class AppServiceGithubToken + { + /// Initializes a new instance of AppServiceGithubToken. + internal AppServiceGithubToken() + { + } + + /// Initializes a new instance of AppServiceGithubToken. + /// Github access token for Appservice CLI github integration. + /// Scope of the github access token. + /// token type. + /// True if valid github token received, False otherwise. + /// Error message if unable to get token. + internal AppServiceGithubToken(string accessToken, string scope, string tokenType, bool? gotToken, string errorMessage) + { + AccessToken = accessToken; + Scope = scope; + TokenType = tokenType; + GotToken = gotToken; + ErrorMessage = errorMessage; + } + + /// Github access token for Appservice CLI github integration. + public string AccessToken { get; } + /// Scope of the github access token. + public string Scope { get; } + /// token type. + public string TokenType { get; } + /// True if valid github token received, False otherwise. + public bool? GotToken { get; } + /// Error message if unable to get token. + public string ErrorMessage { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeploy.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeploy.Serialization.cs new file mode 100644 index 000000000000..f39635e11433 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeploy.Serialization.cs @@ -0,0 +1,178 @@ +// 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; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class MsDeploy : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"); + writer.WriteStringValue(Kind); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(PackageUri)) + { + writer.WritePropertyName("packageUri"); + writer.WriteStringValue(PackageUri); + } + if (Optional.IsDefined(ConnectionString)) + { + writer.WritePropertyName("connectionString"); + writer.WriteStringValue(ConnectionString); + } + if (Optional.IsDefined(DbType)) + { + writer.WritePropertyName("dbType"); + writer.WriteStringValue(DbType); + } + if (Optional.IsDefined(SetParametersXmlFileUri)) + { + writer.WritePropertyName("setParametersXmlFileUri"); + writer.WriteStringValue(SetParametersXmlFileUri); + } + if (Optional.IsCollectionDefined(SetParameters)) + { + writer.WritePropertyName("setParameters"); + writer.WriteStartObject(); + foreach (var item in SetParameters) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(SkipAppData)) + { + writer.WritePropertyName("skipAppData"); + writer.WriteBooleanValue(SkipAppData.Value); + } + if (Optional.IsDefined(AppOffline)) + { + writer.WritePropertyName("appOffline"); + writer.WriteBooleanValue(AppOffline.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static MsDeploy DeserializeMsDeploy(JsonElement element) + { + Optional kind = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional packageUri = default; + Optional connectionString = default; + Optional dbType = default; + Optional setParametersXmlFileUri = default; + Optional> setParameters = default; + Optional skipAppData = default; + Optional appOffline = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind")) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("packageUri")) + { + packageUri = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("connectionString")) + { + connectionString = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("dbType")) + { + dbType = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("setParametersXmlFileUri")) + { + setParametersXmlFileUri = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("setParameters")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + setParameters = dictionary; + continue; + } + if (property0.NameEquals("skipAppData")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + skipAppData = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("appOffline")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + appOffline = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + } + return new MsDeploy(id, name, type, kind.Value, packageUri.Value, connectionString.Value, dbType.Value, setParametersXmlFileUri.Value, Optional.ToDictionary(setParameters), Optional.ToNullable(skipAppData), Optional.ToNullable(appOffline)); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeploy.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeploy.cs new file mode 100644 index 000000000000..8b526d3b5754 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeploy.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.AppService.Models +{ + /// MSDeploy ARM PUT information. + public partial class MsDeploy : ProxyOnlyResource + { + /// Initializes a new instance of MsDeploy. + public MsDeploy() + { + SetParameters = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of MsDeploy. + /// The id. + /// The name. + /// The type. + /// Kind of resource. + /// Package URI. + /// SQL Connection String. + /// Database Type. + /// URI of MSDeploy Parameters file. Must not be set if SetParameters is used. + /// MSDeploy Parameters. Must not be set if SetParametersXmlFileUri is used. + /// + /// Controls whether the MSDeploy operation skips the App_Data directory. + /// If set to <code>true</code>, the existing App_Data directory on the destination + /// will not be deleted, and any App_Data directory in the source will be ignored. + /// Setting is <code>false</code> by default. + /// + /// + /// Sets the AppOffline rule while the MSDeploy operation executes. + /// Setting is <code>false</code> by default. + /// + internal MsDeploy(ResourceIdentifier id, string name, ResourceType type, string kind, string packageUri, string connectionString, string dbType, string setParametersXmlFileUri, IDictionary setParameters, bool? skipAppData, bool? appOffline) : base(id, name, type, kind) + { + PackageUri = packageUri; + ConnectionString = connectionString; + DbType = dbType; + SetParametersXmlFileUri = setParametersXmlFileUri; + SetParameters = setParameters; + SkipAppData = skipAppData; + AppOffline = appOffline; + } + + /// Package URI. + public string PackageUri { get; set; } + /// SQL Connection String. + public string ConnectionString { get; set; } + /// Database Type. + public string DbType { get; set; } + /// URI of MSDeploy Parameters file. Must not be set if SetParameters is used. + public string SetParametersXmlFileUri { get; set; } + /// MSDeploy Parameters. Must not be set if SetParametersXmlFileUri is used. + public IDictionary SetParameters { get; } + /// + /// Controls whether the MSDeploy operation skips the App_Data directory. + /// If set to <code>true</code>, the existing App_Data directory on the destination + /// will not be deleted, and any App_Data directory in the source will be ignored. + /// Setting is <code>false</code> by default. + /// + public bool? SkipAppData { get; set; } + /// + /// Sets the AppOffline rule while the MSDeploy operation executes. + /// Setting is <code>false</code> by default. + /// + public bool? AppOffline { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeployLog.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeployLog.Serialization.cs new file mode 100644 index 000000000000..cafc1465bb3d --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeployLog.Serialization.cs @@ -0,0 +1,91 @@ +// 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; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class MsDeployLog : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"); + writer.WriteStringValue(Kind); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static MsDeployLog DeserializeMsDeployLog(JsonElement element) + { + Optional kind = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional> entries = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind")) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("entries")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(MsDeployLogEntry.DeserializeMsDeployLogEntry(item)); + } + entries = array; + continue; + } + } + continue; + } + } + return new MsDeployLog(id, name, type, kind.Value, Optional.ToList(entries)); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeployLog.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeployLog.cs new file mode 100644 index 000000000000..5b37a42fd82c --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeployLog.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; + +namespace Azure.ResourceManager.AppService.Models +{ + /// MSDeploy log. + public partial class MsDeployLog : ProxyOnlyResource + { + /// Initializes a new instance of MsDeployLog. + public MsDeployLog() + { + Entries = new ChangeTrackingList(); + } + + /// Initializes a new instance of MsDeployLog. + /// The id. + /// The name. + /// The type. + /// Kind of resource. + /// List of log entry messages. + internal MsDeployLog(ResourceIdentifier id, string name, ResourceType type, string kind, IReadOnlyList entries) : base(id, name, type, kind) + { + Entries = entries; + } + + /// List of log entry messages. + public IReadOnlyList Entries { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeployLogEntry.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeployLogEntry.Serialization.cs new file mode 100644 index 000000000000..dbf0d8ce51cc --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeployLogEntry.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class MsDeployLogEntry + { + internal static MsDeployLogEntry DeserializeMsDeployLogEntry(JsonElement element) + { + Optional time = default; + Optional type = default; + Optional message = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("time")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + time = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + type = property.Value.GetString().ToMSDeployLogEntryType(); + continue; + } + if (property.NameEquals("message")) + { + message = property.Value.GetString(); + continue; + } + } + return new MsDeployLogEntry(Optional.ToNullable(time), Optional.ToNullable(type), message.Value); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeployLogEntry.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeployLogEntry.cs new file mode 100644 index 000000000000..f7d1b3c84891 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/MsDeployLogEntry.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.AppService.Models +{ + /// MSDeploy log entry. + public partial class MsDeployLogEntry + { + /// Initializes a new instance of MsDeployLogEntry. + internal MsDeployLogEntry() + { + } + + /// Initializes a new instance of MsDeployLogEntry. + /// Timestamp of log entry. + /// Log entry type. + /// Log entry message. + internal MsDeployLogEntry(DateTimeOffset? time, MSDeployLogEntryType? type, string message) + { + Time = time; + Type = type; + Message = message; + } + + /// Timestamp of log entry. + public DateTimeOffset? Time { get; } + /// Log entry type. + public MSDeployLogEntryType? Type { get; } + /// Log entry message. + public string Message { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigConnectionString.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigConnectionString.cs new file mode 100644 index 000000000000..19ea1a9a6cc7 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigConnectionString.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AppService +{ + /// A Class representing a SiteConfigConnectionString along with the instance operations that can be performed on it. + public partial class SiteConfigConnectionString : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + private readonly ApiKeyVaultReferenceData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteConfigConnectionString() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteConfigConnectionString(ArmResource options, ApiKeyVaultReferenceData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// 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 SiteConfigConnectionString(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal SiteConfigConnectionString(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/config/connectionstrings"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// 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 ApiKeyVaultReferenceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/connectionstrings/{connectionStringKey} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/connectionstrings/{connectionStringKey} + /// OperationId: WebApps_GetSiteConnectionStringKeyVaultReference + /// Description for Gets the config reference and status of an app. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteConfigConnectionString.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetSiteConnectionStringKeyVaultReferenceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteConfigConnectionString(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/connectionstrings/{connectionStringKey} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/connectionstrings/{connectionStringKey} + /// OperationId: WebApps_GetSiteConnectionStringKeyVaultReference + /// Description for Gets the config reference and status of an app. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteConfigConnectionString.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetSiteConnectionStringKeyVaultReference(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteConfigConnectionString(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigConnectionStringCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigConnectionStringCollection.cs new file mode 100644 index 000000000000..e888d47550bd --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteConfigConnectionStringCollection.cs @@ -0,0 +1,311 @@ +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppService +{ + /// A class representing collection of ApiKeyVaultReference and their operations over its parent. + public partial class SiteConfigConnectionStringCollection : ArmCollection, IEnumerable, IAsyncEnumerable + + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteConfigConnectionStringCollection() + { + } + + /// Initializes a new instance of SiteConfigConnectionStringCollection class. + /// The resource representing the parent resource. + internal SiteConfigConnectionStringCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => WebSite.ResourceType; + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/connectionstrings/{connectionStringKey} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_GetSiteConnectionStringKeyVaultReference + /// Description for Gets the config reference and status of an app. + /// The String to use. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string connectionStringKey, CancellationToken cancellationToken = default) + { + if (connectionStringKey == null) + { + throw new ArgumentNullException(nameof(connectionStringKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteConfigConnectionStringCollection.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetSiteConnectionStringKeyVaultReference(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionStringKey, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteConfigConnectionString(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/connectionstrings/{connectionStringKey} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_GetSiteConnectionStringKeyVaultReference + /// Description for Gets the config reference and status of an app. + /// The String to use. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string connectionStringKey, CancellationToken cancellationToken = default) + { + if (connectionStringKey == null) + { + throw new ArgumentNullException(nameof(connectionStringKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteConfigConnectionStringCollection.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetSiteConnectionStringKeyVaultReferenceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionStringKey, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteConfigConnectionString(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// The String to use. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string connectionStringKey, CancellationToken cancellationToken = default) + { + if (connectionStringKey == null) + { + throw new ArgumentNullException(nameof(connectionStringKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteConfigConnectionStringCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetSiteConnectionStringKeyVaultReference(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionStringKey, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteConfigConnectionString(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// The String to use. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string connectionStringKey, CancellationToken cancellationToken = default) + { + if (connectionStringKey == null) + { + throw new ArgumentNullException(nameof(connectionStringKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteConfigConnectionStringCollection.GetIfExistsAsync"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetSiteConnectionStringKeyVaultReferenceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionStringKey, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteConfigConnectionString(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// The String to use. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIfExists(string connectionStringKey, CancellationToken cancellationToken = default) + { + if (connectionStringKey == null) + { + throw new ArgumentNullException(nameof(connectionStringKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteConfigConnectionStringCollection.CheckIfExists"); + scope.Start(); + try + { + var response = GetIfExists(connectionStringKey, 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. + /// The String to use. + /// The cancellation token to use. + /// is null. + public async virtual Task> CheckIfExistsAsync(string connectionStringKey, CancellationToken cancellationToken = default) + { + if (connectionStringKey == null) + { + throw new ArgumentNullException(nameof(connectionStringKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteConfigConnectionStringCollection.CheckIfExistsAsync"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(connectionStringKey, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/connectionstrings + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_GetSiteConnectionStringKeyVaultReferences + /// Description for Gets the config reference app settings and status of an app. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteConfigConnectionStringCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetSiteConnectionStringKeyVaultReferences(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteConfigConnectionString(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteConfigConnectionStringCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetSiteConnectionStringKeyVaultReferencesNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteConfigConnectionString(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/configreferences/connectionstrings + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_GetSiteConnectionStringKeyVaultReferences + /// Description for Gets the config reference app settings and status of an app. + /// 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) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteConfigConnectionStringCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetSiteConnectionStringKeyVaultReferencesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteConfigConnectionString(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteConfigConnectionStringCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetSiteConnectionStringKeyVaultReferencesNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteConfigConnectionString(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteContinuousWebJob.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteContinuousWebJob.cs new file mode 100644 index 000000000000..286483a68e1c --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteContinuousWebJob.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AppService +{ + /// A Class representing a SiteContinuousWebJob along with the instance operations that can be performed on it. + public partial class SiteContinuousWebJob : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + private readonly ContinuousWebJobData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteContinuousWebJob() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteContinuousWebJob(ArmResource options, ContinuousWebJobData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// 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 SiteContinuousWebJob(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal SiteContinuousWebJob(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/continuouswebjobs"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// 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 ContinuousWebJobData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_GetContinuousWebJob + /// Description for Gets a continuous web job by its ID for an app, or a deployment slot. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJob.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetContinuousWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteContinuousWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_GetContinuousWebJob + /// Description for Gets a continuous web job by its ID for an app, or a deployment slot. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJob.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetContinuousWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteContinuousWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_DeleteContinuousWebJob + /// Description for Delete a continuous web job by its ID for an app, or a deployment slot. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJob.Delete"); + scope.Start(); + try + { + var response = await _webAppsRestClient.DeleteContinuousWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WebAppDeleteContinuousWebJobOperation(response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_DeleteContinuousWebJob + /// Description for Delete a continuous web job by its ID for an app, or a deployment slot. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WebAppDeleteContinuousWebJobOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJob.Delete"); + scope.Start(); + try + { + var response = _webAppsRestClient.DeleteContinuousWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new WebAppDeleteContinuousWebJobOperation(response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/start + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_StartContinuousWebJob + /// Description for Start a continuous web job for an app, or a deployment slot. + /// The cancellation token to use. + public async virtual Task StartContinuousWebJobAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJob.StartContinuousWebJob"); + scope.Start(); + try + { + var response = await _webAppsRestClient.StartContinuousWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/start + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_StartContinuousWebJob + /// Description for Start a continuous web job for an app, or a deployment slot. + /// The cancellation token to use. + public virtual Response StartContinuousWebJob(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJob.StartContinuousWebJob"); + scope.Start(); + try + { + var response = _webAppsRestClient.StartContinuousWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/stop + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_StopContinuousWebJob + /// Description for Stop a continuous web job for an app, or a deployment slot. + /// The cancellation token to use. + public async virtual Task StopContinuousWebJobAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJob.StopContinuousWebJob"); + scope.Start(); + try + { + var response = await _webAppsRestClient.StopContinuousWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/stop + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_StopContinuousWebJob + /// Description for Stop a continuous web job for an app, or a deployment slot. + /// The cancellation token to use. + public virtual Response StopContinuousWebJob(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJob.StopContinuousWebJob"); + scope.Start(); + try + { + var response = _webAppsRestClient.StopContinuousWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteContinuousWebJobCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteContinuousWebJobCollection.cs new file mode 100644 index 000000000000..e2279ac7bc77 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteContinuousWebJobCollection.cs @@ -0,0 +1,311 @@ +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppService +{ + /// A class representing collection of ContinuousWebJob and their operations over its parent. + public partial class SiteContinuousWebJobCollection : ArmCollection, IEnumerable, IAsyncEnumerable + + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteContinuousWebJobCollection() + { + } + + /// Initializes a new instance of SiteContinuousWebJobCollection class. + /// The resource representing the parent resource. + internal SiteContinuousWebJobCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => WebSite.ResourceType; + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_GetContinuousWebJob + /// Description for Gets a continuous web job by its ID for an app, or a deployment slot. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJobCollection.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetContinuousWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteContinuousWebJob(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_GetContinuousWebJob + /// Description for Gets a continuous web job by its ID for an app, or a deployment slot. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJobCollection.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetContinuousWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteContinuousWebJob(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetContinuousWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteContinuousWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJobCollection.GetIfExistsAsync"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetContinuousWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteContinuousWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIfExists(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJobCollection.CheckIfExists"); + scope.Start(); + try + { + var response = GetIfExists(webJobName, 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. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public async virtual Task> CheckIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJobCollection.CheckIfExistsAsync"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_ListContinuousWebJobs + /// Description for List continuous web jobs for an app, or a deployment slot. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListContinuousWebJobs(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteContinuousWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListContinuousWebJobsNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteContinuousWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_ListContinuousWebJobs + /// Description for List continuous web jobs for an app, or a deployment slot. + /// 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) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListContinuousWebJobsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteContinuousWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteContinuousWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListContinuousWebJobsNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteContinuousWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteExtension.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteExtension.cs index c4403f27f136..9c4c74006be7 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteExtension.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteExtension.cs @@ -38,6 +38,7 @@ internal SiteExtension(ArmResource options, MSDeployStatusData resource) : base( { HasData = true; _data = resource; + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -47,6 +48,7 @@ internal SiteExtension(ArmResource options, MSDeployStatusData resource) : base( /// The identifier of the resource that is the target of operations. internal SiteExtension(ArmResource options, ResourceIdentifier id) : base(options, id) { + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -84,6 +86,9 @@ public virtual MSDeployStatusData Data } } + /// Gets the parent resource of this resource. + public ArmResource Parent { get; } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy /// OperationId: WebApps_GetMSDeployStatus @@ -146,6 +151,70 @@ public virtual IEnumerable GetAvailableLocations(CancellationToken can return ListAvailableLocations(ResourceType, cancellationToken); } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy + /// OperationId: WebApps_CreateMSDeployOperation + /// Description for Invoke the MSDeploy web app extension. + /// Details of MSDeploy operation. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreateOrUpdateAsync(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (msDeploy == null) + { + throw new ArgumentNullException(nameof(msDeploy)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteExtension.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _webAppsRestClient.CreateMSDeployOperationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, msDeploy, cancellationToken).ConfigureAwait(false); + var operation = new WebAppCreateMSDeployOperationOperation(this, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateMSDeployOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, msDeploy).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy + /// OperationId: WebApps_CreateMSDeployOperation + /// Description for Invoke the MSDeploy web app extension. + /// Details of MSDeploy operation. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WebAppCreateMSDeployOperationOperation CreateOrUpdate(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (msDeploy == null) + { + throw new ArgumentNullException(nameof(msDeploy)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteExtension.CreateOrUpdate"); + scope.Start(); + try + { + var response = _webAppsRestClient.CreateMSDeployOperation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, msDeploy, cancellationToken); + var operation = new WebAppCreateMSDeployOperationOperation(this, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateMSDeployOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, msDeploy).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy/log /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy /// OperationId: WebApps_GetMSDeployLog diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteExtensionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteExtensionCollection.cs deleted file mode 100644 index 21988109de07..000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteExtensionCollection.cs +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppService.Models; -using Azure.ResourceManager.Core; - -namespace Azure.ResourceManager.AppService -{ - /// A class representing collection of MSDeployStatus and their operations over its parent. - public partial class SiteExtensionCollection : ArmCollection - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly WebAppsRestOperations _webAppsRestClient; - - /// Initializes a new instance of the class for mocking. - protected SiteExtensionCollection() - { - } - - /// Initializes a new instance of SiteExtensionCollection class. - /// The resource representing the parent resource. - internal SiteExtensionCollection(ArmResource parent) : base(parent) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => WebSite.ResourceType; - - // Collection level operations. - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} - /// OperationId: WebApps_CreateMSDeployOperation - /// Description for Invoke the MSDeploy web app extension. - /// Details of MSDeploy operation. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WebAppCreateMSDeployOperationOperation CreateOrUpdate(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (msDeploy == null) - { - throw new ArgumentNullException(nameof(msDeploy)); - } - - using var scope = _clientDiagnostics.CreateScope("SiteExtensionCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _webAppsRestClient.CreateMSDeployOperation(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, msDeploy, cancellationToken); - var operation = new WebAppCreateMSDeployOperationOperation(Parent, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateMSDeployOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, msDeploy).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} - /// OperationId: WebApps_CreateMSDeployOperation - /// Description for Invoke the MSDeploy web app extension. - /// Details of MSDeploy operation. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task CreateOrUpdateAsync(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (msDeploy == null) - { - throw new ArgumentNullException(nameof(msDeploy)); - } - - using var scope = _clientDiagnostics.CreateScope("SiteExtensionCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _webAppsRestClient.CreateMSDeployOperationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, msDeploy, cancellationToken).ConfigureAwait(false); - var operation = new WebAppCreateMSDeployOperationOperation(Parent, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateMSDeployOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, msDeploy).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} - /// OperationId: WebApps_GetMSDeployStatus - /// Description for Get the status of the last MSDeploy operation. - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteExtensionCollection.Get"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetMSDeployStatus(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - if (response.Value == null) - throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new SiteExtension(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} - /// OperationId: WebApps_GetMSDeployStatus - /// Description for Get the status of the last MSDeploy operation. - /// The cancellation token to use. - public async virtual Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteExtensionCollection.Get"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetMSDeployStatusAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new SiteExtension(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response GetIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteExtensionCollection.GetIfExists"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetMSDeployStatus(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new SiteExtension(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public async virtual Task> GetIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteExtensionCollection.GetIfExistsAsync"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetMSDeployStatusAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new SiteExtension(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response CheckIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteExtensionCollection.CheckIfExists"); - scope.Start(); - try - { - var response = GetIfExists(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. - /// The cancellation token to use. - public async virtual Task> CheckIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteExtensionCollection.CheckIfExistsAsync"); - scope.Start(); - try - { - var response = await GetIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - // Builders. - // public ArmBuilder Construct() { } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHybridConnection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHybridConnection.cs new file mode 100644 index 000000000000..2d1d2304c38b --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHybridConnection.cs @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AppService +{ + /// A Class representing a SiteHybridConnection along with the instance operations that can be performed on it. + public partial class SiteHybridConnection : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + private readonly RelayServiceConnectionEntityData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteHybridConnection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteHybridConnection(ArmResource options, RelayServiceConnectionEntityData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// 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 SiteHybridConnection(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal SiteHybridConnection(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/hybridconnection"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// 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 RelayServiceConnectionEntityData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// OperationId: WebApps_GetRelayServiceConnection + /// Description for Gets a hybrid connection configuration by its name. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteHybridConnection.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetRelayServiceConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteHybridConnection(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// OperationId: WebApps_GetRelayServiceConnection + /// Description for Gets a hybrid connection configuration by its name. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteHybridConnection.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetRelayServiceConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteHybridConnection(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// OperationId: WebApps_DeleteRelayServiceConnection + /// Description for Deletes a relay service connection by its name. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteHybridConnection.Delete"); + scope.Start(); + try + { + var response = await _webAppsRestClient.DeleteRelayServiceConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WebAppDeleteRelayServiceConnectionOperation(response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// OperationId: WebApps_DeleteRelayServiceConnection + /// Description for Deletes a relay service connection by its name. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WebAppDeleteRelayServiceConnectionOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteHybridConnection.Delete"); + scope.Start(); + try + { + var response = _webAppsRestClient.DeleteRelayServiceConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new WebAppDeleteRelayServiceConnectionOperation(response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// OperationId: WebApps_UpdateRelayServiceConnection + /// Description for Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + /// Details of the hybrid connection configuration. + /// The cancellation token to use. + /// is null. + public async virtual Task> UpdateAsync(RelayServiceConnectionEntityData connectionEnvelope, CancellationToken cancellationToken = default) + { + if (connectionEnvelope == null) + { + throw new ArgumentNullException(nameof(connectionEnvelope)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteHybridConnection.Update"); + scope.Start(); + try + { + var response = await _webAppsRestClient.UpdateRelayServiceConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connectionEnvelope, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteHybridConnection(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// OperationId: WebApps_UpdateRelayServiceConnection + /// Description for Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + /// Details of the hybrid connection configuration. + /// The cancellation token to use. + /// is null. + public virtual Response Update(RelayServiceConnectionEntityData connectionEnvelope, CancellationToken cancellationToken = default) + { + if (connectionEnvelope == null) + { + throw new ArgumentNullException(nameof(connectionEnvelope)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteHybridConnection.Update"); + scope.Start(); + try + { + var response = _webAppsRestClient.UpdateRelayServiceConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connectionEnvelope, cancellationToken); + return Response.FromValue(new SiteHybridConnection(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHybridConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHybridConnectionCollection.cs new file mode 100644 index 000000000000..9498284b91b5 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteHybridConnectionCollection.cs @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppService +{ + /// A class representing collection of RelayServiceConnectionEntity and their operations over its parent. + public partial class SiteHybridConnectionCollection : ArmCollection + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteHybridConnectionCollection() + { + } + + /// Initializes a new instance of SiteHybridConnectionCollection class. + /// The resource representing the parent resource. + internal SiteHybridConnectionCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => WebSite.ResourceType; + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_CreateOrUpdateRelayServiceConnection + /// Description for Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + /// Name of the hybrid connection configuration. + /// Details of the hybrid connection configuration. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual WebAppCreateOrUpdateRelayServiceConnectionOperation CreateOrUpdate(string entityName, RelayServiceConnectionEntityData connectionEnvelope, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (entityName == null) + { + throw new ArgumentNullException(nameof(entityName)); + } + if (connectionEnvelope == null) + { + throw new ArgumentNullException(nameof(connectionEnvelope)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteHybridConnectionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _webAppsRestClient.CreateOrUpdateRelayServiceConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, entityName, connectionEnvelope, cancellationToken); + var operation = new WebAppCreateOrUpdateRelayServiceConnectionOperation(Parent, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_CreateOrUpdateRelayServiceConnection + /// Description for Creates a new hybrid connection configuration (PUT), or updates an existing one (PATCH). + /// Name of the hybrid connection configuration. + /// Details of the hybrid connection configuration. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(string entityName, RelayServiceConnectionEntityData connectionEnvelope, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (entityName == null) + { + throw new ArgumentNullException(nameof(entityName)); + } + if (connectionEnvelope == null) + { + throw new ArgumentNullException(nameof(connectionEnvelope)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteHybridConnectionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _webAppsRestClient.CreateOrUpdateRelayServiceConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, entityName, connectionEnvelope, cancellationToken).ConfigureAwait(false); + var operation = new WebAppCreateOrUpdateRelayServiceConnectionOperation(Parent, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_GetRelayServiceConnection + /// Description for Gets a hybrid connection configuration by its name. + /// Name of the hybrid connection. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string entityName, CancellationToken cancellationToken = default) + { + if (entityName == null) + { + throw new ArgumentNullException(nameof(entityName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteHybridConnectionCollection.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetRelayServiceConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, entityName, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteHybridConnection(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/hybridconnection/{entityName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_GetRelayServiceConnection + /// Description for Gets a hybrid connection configuration by its name. + /// Name of the hybrid connection. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string entityName, CancellationToken cancellationToken = default) + { + if (entityName == null) + { + throw new ArgumentNullException(nameof(entityName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteHybridConnectionCollection.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetRelayServiceConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, entityName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteHybridConnection(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the hybrid connection. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string entityName, CancellationToken cancellationToken = default) + { + if (entityName == null) + { + throw new ArgumentNullException(nameof(entityName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteHybridConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetRelayServiceConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, entityName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteHybridConnection(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the hybrid connection. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string entityName, CancellationToken cancellationToken = default) + { + if (entityName == null) + { + throw new ArgumentNullException(nameof(entityName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteHybridConnectionCollection.GetIfExistsAsync"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetRelayServiceConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, entityName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteHybridConnection(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the hybrid connection. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIfExists(string entityName, CancellationToken cancellationToken = default) + { + if (entityName == null) + { + throw new ArgumentNullException(nameof(entityName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteHybridConnectionCollection.CheckIfExists"); + scope.Start(); + try + { + var response = GetIfExists(entityName, 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. + /// Name of the hybrid connection. + /// The cancellation token to use. + /// is null. + public async virtual Task> CheckIfExistsAsync(string entityName, CancellationToken cancellationToken = default) + { + if (entityName == null) + { + throw new ArgumentNullException(nameof(entityName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteHybridConnectionCollection.CheckIfExistsAsync"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(entityName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstance.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstance.cs index eece163ffcba..72539c9d5433 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstance.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstance.cs @@ -147,11 +147,11 @@ public virtual IEnumerable GetAvailableLocations(CancellationToken can #region SiteInstanceExtension - /// Gets a collection of SiteInstanceExtensions in the SiteInstance. - /// An object representing collection of SiteInstanceExtensions and their operations over a SiteInstance. - public SiteInstanceExtensionCollection GetSiteInstanceExtensions() + /// Gets an object representing a SiteInstanceExtension along with the instance operations that can be performed on it in the SiteInstance. + /// Returns a object. + public SiteInstanceExtension GetSiteInstanceExtension() { - return new SiteInstanceExtensionCollection(this); + return new SiteInstanceExtension(this, new ResourceIdentifier(Id.ToString() + "/extensions/MSDeploy")); } #endregion diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceExtension.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceExtension.cs index 872be77d6393..4ea66b5d73e7 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceExtension.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceExtension.cs @@ -38,6 +38,7 @@ internal SiteInstanceExtension(ArmResource options, MSDeployStatusData resource) { HasData = true; _data = resource; + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -47,6 +48,7 @@ internal SiteInstanceExtension(ArmResource options, MSDeployStatusData resource) /// The identifier of the resource that is the target of operations. internal SiteInstanceExtension(ArmResource options, ResourceIdentifier id) : base(options, id) { + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -84,6 +86,9 @@ public virtual MSDeployStatusData Data } } + /// Gets the parent resource of this resource. + public ArmResource Parent { get; } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy /// OperationId: WebApps_GetInstanceMsDeployStatus @@ -146,6 +151,70 @@ public virtual IEnumerable GetAvailableLocations(CancellationToken can return ListAvailableLocations(ResourceType, cancellationToken); } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy + /// OperationId: WebApps_CreateInstanceMSDeployOperation + /// Description for Invoke the MSDeploy web app extension. + /// Details of MSDeploy operation. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreateOrUpdateAsync(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (msDeploy == null) + { + throw new ArgumentNullException(nameof(msDeploy)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteInstanceExtension.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _webAppsRestClient.CreateInstanceMSDeployOperationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, msDeploy, cancellationToken).ConfigureAwait(false); + var operation = new WebAppCreateInstanceMSDeployOperationOperation(this, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateInstanceMSDeployOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, msDeploy).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy + /// OperationId: WebApps_CreateInstanceMSDeployOperation + /// Description for Invoke the MSDeploy web app extension. + /// Details of MSDeploy operation. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WebAppCreateInstanceMSDeployOperationOperation CreateOrUpdate(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (msDeploy == null) + { + throw new ArgumentNullException(nameof(msDeploy)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteInstanceExtension.CreateOrUpdate"); + scope.Start(); + try + { + var response = _webAppsRestClient.CreateInstanceMSDeployOperation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, msDeploy, cancellationToken); + var operation = new WebAppCreateInstanceMSDeployOperationOperation(this, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateInstanceMSDeployOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, msDeploy).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy/log /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy /// OperationId: WebApps_GetInstanceMSDeployLog diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceExtensionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceExtensionCollection.cs deleted file mode 100644 index 6a93a62029cc..000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceExtensionCollection.cs +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppService.Models; -using Azure.ResourceManager.Core; - -namespace Azure.ResourceManager.AppService -{ - /// A class representing collection of MSDeployStatus and their operations over its parent. - public partial class SiteInstanceExtensionCollection : ArmCollection - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly WebAppsRestOperations _webAppsRestClient; - - /// Initializes a new instance of the class for mocking. - protected SiteInstanceExtensionCollection() - { - } - - /// Initializes a new instance of SiteInstanceExtensionCollection class. - /// The resource representing the parent resource. - internal SiteInstanceExtensionCollection(ArmResource parent) : base(parent) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => SiteInstance.ResourceType; - - // Collection level operations. - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId} - /// OperationId: WebApps_CreateInstanceMSDeployOperation - /// Description for Invoke the MSDeploy web app extension. - /// Details of MSDeploy operation. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WebAppCreateInstanceMSDeployOperationOperation CreateOrUpdate(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (msDeploy == null) - { - throw new ArgumentNullException(nameof(msDeploy)); - } - - using var scope = _clientDiagnostics.CreateScope("SiteInstanceExtensionCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _webAppsRestClient.CreateInstanceMSDeployOperation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, msDeploy, cancellationToken); - var operation = new WebAppCreateInstanceMSDeployOperationOperation(Parent, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateInstanceMSDeployOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, msDeploy).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId} - /// OperationId: WebApps_CreateInstanceMSDeployOperation - /// Description for Invoke the MSDeploy web app extension. - /// Details of MSDeploy operation. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task CreateOrUpdateAsync(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (msDeploy == null) - { - throw new ArgumentNullException(nameof(msDeploy)); - } - - using var scope = _clientDiagnostics.CreateScope("SiteInstanceExtensionCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _webAppsRestClient.CreateInstanceMSDeployOperationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, msDeploy, cancellationToken).ConfigureAwait(false); - var operation = new WebAppCreateInstanceMSDeployOperationOperation(Parent, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateInstanceMSDeployOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, msDeploy).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId} - /// OperationId: WebApps_GetInstanceMsDeployStatus - /// Description for Get the status of the last MSDeploy operation. - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteInstanceExtensionCollection.Get"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetInstanceMsDeployStatus(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new SiteInstanceExtension(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/instances/{instanceId} - /// OperationId: WebApps_GetInstanceMsDeployStatus - /// Description for Get the status of the last MSDeploy operation. - /// The cancellation token to use. - public async virtual Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteInstanceExtensionCollection.Get"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetInstanceMsDeployStatusAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new SiteInstanceExtension(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response GetIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteInstanceExtensionCollection.GetIfExists"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetInstanceMsDeployStatus(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new SiteInstanceExtension(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public async virtual Task> GetIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteInstanceExtensionCollection.GetIfExistsAsync"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetInstanceMsDeployStatusAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new SiteInstanceExtension(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response CheckIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteInstanceExtensionCollection.CheckIfExists"); - scope.Start(); - try - { - var response = GetIfExists(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. - /// The cancellation token to use. - public async virtual Task> CheckIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteInstanceExtensionCollection.CheckIfExistsAsync"); - scope.Start(); - try - { - var response = await GetIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - // Builders. - // public ArmBuilder Construct() { } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteNetworkConfig.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteNetworkConfig.cs index 777d98e875df..380f9992e478 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteNetworkConfig.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteNetworkConfig.cs @@ -38,6 +38,7 @@ internal SiteNetworkConfig(ArmResource options, SwiftVirtualNetworkData resource { HasData = true; _data = resource; + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -47,6 +48,7 @@ internal SiteNetworkConfig(ArmResource options, SwiftVirtualNetworkData resource /// The identifier of the resource that is the target of operations. internal SiteNetworkConfig(ArmResource options, ResourceIdentifier id) : base(options, id) { + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -84,6 +86,9 @@ public virtual SwiftVirtualNetworkData Data } } + /// Gets the parent resource of this resource. + public ArmResource Parent { get; } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork /// OperationId: WebApps_GetSwiftVirtualNetworkConnection @@ -196,6 +201,76 @@ public virtual WebAppDeleteSwiftVirtualNetworkOperation Delete(bool waitForCompl } } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork + /// OperationId: WebApps_CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck + /// + /// Description for Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not + /// in use by another App Service Plan other than the one this App is in. + /// + /// Properties of the Virtual Network connection. See example. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreateOrUpdateAsync(SwiftVirtualNetworkData connectionEnvelope, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (connectionEnvelope == null) + { + throw new ArgumentNullException(nameof(connectionEnvelope)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteNetworkConfig.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _webAppsRestClient.CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, connectionEnvelope, cancellationToken).ConfigureAwait(false); + var operation = new WebAppCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckOperation(this, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork + /// OperationId: WebApps_CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck + /// + /// Description for Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not + /// in use by another App Service Plan other than the one this App is in. + /// + /// Properties of the Virtual Network connection. See example. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WebAppCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckOperation CreateOrUpdate(SwiftVirtualNetworkData connectionEnvelope, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (connectionEnvelope == null) + { + throw new ArgumentNullException(nameof(connectionEnvelope)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteNetworkConfig.CreateOrUpdate"); + scope.Start(); + try + { + var response = _webAppsRestClient.CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, connectionEnvelope, cancellationToken); + var operation = new WebAppCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckOperation(this, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork /// OperationId: WebApps_UpdateSwiftVirtualNetworkConnectionWithCheck diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteNetworkConfigCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteNetworkConfigCollection.cs deleted file mode 100644 index 6ec7ffb59b3f..000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteNetworkConfigCollection.cs +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppService.Models; -using Azure.ResourceManager.Core; - -namespace Azure.ResourceManager.AppService -{ - /// A class representing collection of SwiftVirtualNetwork and their operations over its parent. - public partial class SiteNetworkConfigCollection : ArmCollection - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly WebAppsRestOperations _webAppsRestClient; - - /// Initializes a new instance of the class for mocking. - protected SiteNetworkConfigCollection() - { - } - - /// Initializes a new instance of SiteNetworkConfigCollection class. - /// The resource representing the parent resource. - internal SiteNetworkConfigCollection(ArmResource parent) : base(parent) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => WebSite.ResourceType; - - // Collection level operations. - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} - /// OperationId: WebApps_CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck - /// - /// Description for Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not - /// in use by another App Service Plan other than the one this App is in. - /// - /// Properties of the Virtual Network connection. See example. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WebAppCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckOperation CreateOrUpdate(SwiftVirtualNetworkData connectionEnvelope, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (connectionEnvelope == null) - { - throw new ArgumentNullException(nameof(connectionEnvelope)); - } - - using var scope = _clientDiagnostics.CreateScope("SiteNetworkConfigCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _webAppsRestClient.CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionEnvelope, cancellationToken); - var operation = new WebAppCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckOperation(Parent, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} - /// OperationId: WebApps_CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck - /// - /// Description for Integrates this Web App with a Virtual Network. This requires that 1) "swiftSupported" is true when doing a GET against this resource, and 2) that the target Subnet has already been delegated, and is not - /// in use by another App Service Plan other than the one this App is in. - /// - /// Properties of the Virtual Network connection. See example. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task CreateOrUpdateAsync(SwiftVirtualNetworkData connectionEnvelope, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (connectionEnvelope == null) - { - throw new ArgumentNullException(nameof(connectionEnvelope)); - } - - using var scope = _clientDiagnostics.CreateScope("SiteNetworkConfigCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _webAppsRestClient.CreateOrUpdateSwiftVirtualNetworkConnectionWithCheckAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, connectionEnvelope, cancellationToken).ConfigureAwait(false); - var operation = new WebAppCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckOperation(Parent, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} - /// OperationId: WebApps_GetSwiftVirtualNetworkConnection - /// Description for Gets a Swift Virtual Network connection. - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteNetworkConfigCollection.Get"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetSwiftVirtualNetworkConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - if (response.Value == null) - throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new SiteNetworkConfig(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/networkConfig/virtualNetwork - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} - /// OperationId: WebApps_GetSwiftVirtualNetworkConnection - /// Description for Gets a Swift Virtual Network connection. - /// The cancellation token to use. - public async virtual Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteNetworkConfigCollection.Get"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetSwiftVirtualNetworkConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new SiteNetworkConfig(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response GetIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteNetworkConfigCollection.GetIfExists"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetSwiftVirtualNetworkConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new SiteNetworkConfig(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public async virtual Task> GetIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteNetworkConfigCollection.GetIfExistsAsync"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetSwiftVirtualNetworkConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new SiteNetworkConfig(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response CheckIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteNetworkConfigCollection.CheckIfExists"); - scope.Start(); - try - { - var response = GetIfExists(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. - /// The cancellation token to use. - public async virtual Task> CheckIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteNetworkConfigCollection.CheckIfExistsAsync"); - scope.Start(); - try - { - var response = await GetIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - // Builders. - // public ArmBuilder Construct() { } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePremierAddon.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePremierAddon.cs new file mode 100644 index 000000000000..5d07800473b7 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePremierAddon.cs @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AppService +{ + /// A Class representing a SitePremierAddon along with the instance operations that can be performed on it. + public partial class SitePremierAddon : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + private readonly PremierAddOnData _data; + + /// Initializes a new instance of the class for mocking. + protected SitePremierAddon() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SitePremierAddon(ArmResource options, PremierAddOnData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// 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 SitePremierAddon(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal SitePremierAddon(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/premieraddons"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// 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 PremierAddOnData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// OperationId: WebApps_GetPremierAddOn + /// Description for Gets a named add-on of an app. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SitePremierAddon.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetPremierAddOnAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SitePremierAddon(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// OperationId: WebApps_GetPremierAddOn + /// Description for Gets a named add-on of an app. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SitePremierAddon.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetPremierAddOn(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SitePremierAddon(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// OperationId: WebApps_DeletePremierAddOn + /// Description for Delete a premier add-on from an app. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SitePremierAddon.Delete"); + scope.Start(); + try + { + var response = await _webAppsRestClient.DeletePremierAddOnAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WebAppDeletePremierAddOnOperation(response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// OperationId: WebApps_DeletePremierAddOn + /// Description for Delete a premier add-on from an app. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WebAppDeletePremierAddOnOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SitePremierAddon.Delete"); + scope.Start(); + try + { + var response = _webAppsRestClient.DeletePremierAddOn(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new WebAppDeletePremierAddOnOperation(response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// OperationId: WebApps_UpdatePremierAddOn + /// Description for Updates a named add-on of an app. + /// A JSON representation of the edited premier add-on. + /// The cancellation token to use. + /// is null. + public async virtual Task> UpdateAsync(PremierAddOnPatchResource premierAddOn, CancellationToken cancellationToken = default) + { + if (premierAddOn == null) + { + throw new ArgumentNullException(nameof(premierAddOn)); + } + + using var scope = _clientDiagnostics.CreateScope("SitePremierAddon.Update"); + scope.Start(); + try + { + var response = await _webAppsRestClient.UpdatePremierAddOnAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, premierAddOn, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SitePremierAddon(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// OperationId: WebApps_UpdatePremierAddOn + /// Description for Updates a named add-on of an app. + /// A JSON representation of the edited premier add-on. + /// The cancellation token to use. + /// is null. + public virtual Response Update(PremierAddOnPatchResource premierAddOn, CancellationToken cancellationToken = default) + { + if (premierAddOn == null) + { + throw new ArgumentNullException(nameof(premierAddOn)); + } + + using var scope = _clientDiagnostics.CreateScope("SitePremierAddon.Update"); + scope.Start(); + try + { + var response = _webAppsRestClient.UpdatePremierAddOn(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, premierAddOn, cancellationToken); + return Response.FromValue(new SitePremierAddon(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePremierAddonCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePremierAddonCollection.cs new file mode 100644 index 000000000000..de9b792c3154 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SitePremierAddonCollection.cs @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppService +{ + /// A class representing collection of PremierAddOn and their operations over its parent. + public partial class SitePremierAddonCollection : ArmCollection + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SitePremierAddonCollection() + { + } + + /// Initializes a new instance of SitePremierAddonCollection class. + /// The resource representing the parent resource. + internal SitePremierAddonCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => WebSite.ResourceType; + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_AddPremierAddOn + /// Description for Updates a named add-on of an app. + /// Add-on name. + /// A JSON representation of the edited premier add-on. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual WebAppAddPremierAddOnOperation CreateOrUpdate(string premierAddOnName, PremierAddOnData premierAddOn, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + if (premierAddOn == null) + { + throw new ArgumentNullException(nameof(premierAddOn)); + } + + using var scope = _clientDiagnostics.CreateScope("SitePremierAddonCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _webAppsRestClient.AddPremierAddOn(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, premierAddOnName, premierAddOn, cancellationToken); + var operation = new WebAppAddPremierAddOnOperation(Parent, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_AddPremierAddOn + /// Description for Updates a named add-on of an app. + /// Add-on name. + /// A JSON representation of the edited premier add-on. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(string premierAddOnName, PremierAddOnData premierAddOn, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + if (premierAddOn == null) + { + throw new ArgumentNullException(nameof(premierAddOn)); + } + + using var scope = _clientDiagnostics.CreateScope("SitePremierAddonCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _webAppsRestClient.AddPremierAddOnAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, premierAddOnName, premierAddOn, cancellationToken).ConfigureAwait(false); + var operation = new WebAppAddPremierAddOnOperation(Parent, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_GetPremierAddOn + /// Description for Gets a named add-on of an app. + /// Add-on name. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string premierAddOnName, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + + using var scope = _clientDiagnostics.CreateScope("SitePremierAddonCollection.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetPremierAddOn(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, premierAddOnName, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SitePremierAddon(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_GetPremierAddOn + /// Description for Gets a named add-on of an app. + /// Add-on name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string premierAddOnName, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + + using var scope = _clientDiagnostics.CreateScope("SitePremierAddonCollection.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetPremierAddOnAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, premierAddOnName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SitePremierAddon(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Add-on name. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string premierAddOnName, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + + using var scope = _clientDiagnostics.CreateScope("SitePremierAddonCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetPremierAddOn(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, premierAddOnName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SitePremierAddon(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Add-on name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string premierAddOnName, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + + using var scope = _clientDiagnostics.CreateScope("SitePremierAddonCollection.GetIfExistsAsync"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetPremierAddOnAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, premierAddOnName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SitePremierAddon(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Add-on name. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIfExists(string premierAddOnName, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + + using var scope = _clientDiagnostics.CreateScope("SitePremierAddonCollection.CheckIfExists"); + scope.Start(); + try + { + var response = GetIfExists(premierAddOnName, 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. + /// Add-on name. + /// The cancellation token to use. + /// is null. + public async virtual Task> CheckIfExistsAsync(string premierAddOnName, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + + using var scope = _clientDiagnostics.CreateScope("SitePremierAddonCollection.CheckIfExistsAsync"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(premierAddOnName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlot.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlot.cs index 2f120dfbdf63..02b27c85ca1b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlot.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlot.cs @@ -3863,11 +3863,11 @@ public SiteSlotDomainOwnershipIdentifierCollection GetSiteSlotDomainOwnershipIde #region SiteSlotExtension - /// Gets a collection of SiteSlotExtensions in the SiteSlot. - /// An object representing collection of SiteSlotExtensions and their operations over a SiteSlot. - public SiteSlotExtensionCollection GetSiteSlotExtensions() + /// Gets an object representing a SiteSlotExtension along with the instance operations that can be performed on it in the SiteSlot. + /// Returns a object. + public SiteSlotExtension GetSiteSlotExtension() { - return new SiteSlotExtensionCollection(this); + return new SiteSlotExtension(this, new ResourceIdentifier(Id.ToString() + "/extensions/MSDeploy")); } #endregion @@ -3943,11 +3943,11 @@ public SiteSlotPremierAddOnCollection GetSiteSlotPremierAddOns() #region SiteSlotPrivateAccess - /// Gets a collection of SiteSlotPrivateAccesses in the SiteSlot. - /// An object representing collection of SiteSlotPrivateAccesses and their operations over a SiteSlot. - public SiteSlotPrivateAccessCollection GetSiteSlotPrivateAccesses() + /// Gets an object representing a SiteSlotPrivateAccess along with the instance operations that can be performed on it in the SiteSlot. + /// Returns a object. + public SiteSlotPrivateAccess GetSiteSlotPrivateAccess() { - return new SiteSlotPrivateAccessCollection(this); + return new SiteSlotPrivateAccess(this, new ResourceIdentifier(Id.ToString() + "/privateAccess/virtualNetworks")); } #endregion @@ -3973,11 +3973,11 @@ public SiteSlotSiteextensionCollection GetSiteSlotSiteextensions() #region MigrateMySqlStatus - /// Gets a collection of MigrateMySqlStatuses in the SiteSlot. - /// An object representing collection of MigrateMySqlStatuses and their operations over a SiteSlot. - public MigrateMySqlStatusCollection GetMigrateMySqlStatuses() + /// Gets an object representing a MigrateMySqlStatus along with the instance operations that can be performed on it in the SiteSlot. + /// Returns a object. + public MigrateMySqlStatus GetMigrateMySqlStatus() { - return new MigrateMySqlStatusCollection(this); + return new MigrateMySqlStatus(this, new ResourceIdentifier(Id.ToString() + "/migratemysql/status")); } #endregion @@ -3993,11 +3993,11 @@ public NetworkFeaturesCollection GetNetworkFeatures() #region SiteSlotSourcecontrol - /// Gets a collection of SiteSlotSourcecontrols in the SiteSlot. - /// An object representing collection of SiteSlotSourcecontrols and their operations over a SiteSlot. - public SiteSlotSourcecontrolCollection GetSiteSlotSourcecontrols() + /// Gets an object representing a SiteSlotSourcecontrol along with the instance operations that can be performed on it in the SiteSlot. + /// Returns a object. + public SiteSlotSourcecontrol GetSiteSlotSourcecontrol() { - return new SiteSlotSourcecontrolCollection(this); + return new SiteSlotSourcecontrol(this, new ResourceIdentifier(Id.ToString() + "/sourcecontrols/web")); } #endregion diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigAppSetting.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigAppSetting.cs new file mode 100644 index 000000000000..2f75b10e8ac4 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigAppSetting.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AppService +{ + /// A Class representing a SiteSlotConfigAppSetting along with the instance operations that can be performed on it. + public partial class SiteSlotConfigAppSetting : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + private readonly ApiKeyVaultReferenceData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteSlotConfigAppSetting() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteSlotConfigAppSetting(ArmResource options, ApiKeyVaultReferenceData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// 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 SiteSlotConfigAppSetting(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal SiteSlotConfigAppSetting(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/slots/config/appsettings"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// 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 ApiKeyVaultReferenceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/appsettings/{appSettingKey} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/appsettings/{appSettingKey} + /// OperationId: WebApps_GetAppSettingKeyVaultReferenceSlot + /// Description for Gets the config reference and status of an app. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigAppSetting.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetAppSettingKeyVaultReferenceSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteSlotConfigAppSetting(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/appsettings/{appSettingKey} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/appsettings/{appSettingKey} + /// OperationId: WebApps_GetAppSettingKeyVaultReferenceSlot + /// Description for Gets the config reference and status of an app. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigAppSetting.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetAppSettingKeyVaultReferenceSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteSlotConfigAppSetting(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigAppSettingCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigAppSettingCollection.cs new file mode 100644 index 000000000000..09635cd6fa25 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigAppSettingCollection.cs @@ -0,0 +1,311 @@ +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppService +{ + /// A class representing collection of ApiKeyVaultReference and their operations over its parent. + public partial class SiteSlotConfigAppSettingCollection : ArmCollection, IEnumerable, IAsyncEnumerable + + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteSlotConfigAppSettingCollection() + { + } + + /// Initializes a new instance of SiteSlotConfigAppSettingCollection class. + /// The resource representing the parent resource. + internal SiteSlotConfigAppSettingCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => SiteSlot.ResourceType; + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/appsettings/{appSettingKey} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetAppSettingKeyVaultReferenceSlot + /// Description for Gets the config reference and status of an app. + /// App Setting key name. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string appSettingKey, CancellationToken cancellationToken = default) + { + if (appSettingKey == null) + { + throw new ArgumentNullException(nameof(appSettingKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigAppSettingCollection.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetAppSettingKeyVaultReferenceSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, appSettingKey, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteSlotConfigAppSetting(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/appsettings/{appSettingKey} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetAppSettingKeyVaultReferenceSlot + /// Description for Gets the config reference and status of an app. + /// App Setting key name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string appSettingKey, CancellationToken cancellationToken = default) + { + if (appSettingKey == null) + { + throw new ArgumentNullException(nameof(appSettingKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigAppSettingCollection.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetAppSettingKeyVaultReferenceSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, appSettingKey, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteSlotConfigAppSetting(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// App Setting key name. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string appSettingKey, CancellationToken cancellationToken = default) + { + if (appSettingKey == null) + { + throw new ArgumentNullException(nameof(appSettingKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigAppSettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetAppSettingKeyVaultReferenceSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, appSettingKey, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteSlotConfigAppSetting(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// App Setting key name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string appSettingKey, CancellationToken cancellationToken = default) + { + if (appSettingKey == null) + { + throw new ArgumentNullException(nameof(appSettingKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigAppSettingCollection.GetIfExistsAsync"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetAppSettingKeyVaultReferenceSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, appSettingKey, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteSlotConfigAppSetting(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// App Setting key name. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIfExists(string appSettingKey, CancellationToken cancellationToken = default) + { + if (appSettingKey == null) + { + throw new ArgumentNullException(nameof(appSettingKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigAppSettingCollection.CheckIfExists"); + scope.Start(); + try + { + var response = GetIfExists(appSettingKey, 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. + /// App Setting key name. + /// The cancellation token to use. + /// is null. + public async virtual Task> CheckIfExistsAsync(string appSettingKey, CancellationToken cancellationToken = default) + { + if (appSettingKey == null) + { + throw new ArgumentNullException(nameof(appSettingKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigAppSettingCollection.CheckIfExistsAsync"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(appSettingKey, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/appsettings + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetAppSettingsKeyVaultReferencesSlot + /// Description for Gets the config reference app settings and status of an app. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigAppSettingCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetAppSettingsKeyVaultReferencesSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotConfigAppSetting(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigAppSettingCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetAppSettingsKeyVaultReferencesSlotNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotConfigAppSetting(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/appsettings + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetAppSettingsKeyVaultReferencesSlot + /// Description for Gets the config reference app settings and status of an app. + /// 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) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigAppSettingCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetAppSettingsKeyVaultReferencesSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotConfigAppSetting(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigAppSettingCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetAppSettingsKeyVaultReferencesSlotNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotConfigAppSetting(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigConnectionString.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigConnectionString.cs new file mode 100644 index 000000000000..0d151368c1a7 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigConnectionString.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AppService +{ + /// A Class representing a SiteSlotConfigConnectionString along with the instance operations that can be performed on it. + public partial class SiteSlotConfigConnectionString : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + private readonly ApiKeyVaultReferenceData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteSlotConfigConnectionString() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteSlotConfigConnectionString(ArmResource options, ApiKeyVaultReferenceData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// 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 SiteSlotConfigConnectionString(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal SiteSlotConfigConnectionString(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/slots/config/connectionstrings"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// 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 ApiKeyVaultReferenceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/connectionstrings/{connectionStringKey} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/connectionstrings/{connectionStringKey} + /// OperationId: WebApps_GetSiteConnectionStringKeyVaultReferenceSlot + /// Description for Gets the config reference and status of an app. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigConnectionString.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetSiteConnectionStringKeyVaultReferenceSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteSlotConfigConnectionString(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/connectionstrings/{connectionStringKey} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/connectionstrings/{connectionStringKey} + /// OperationId: WebApps_GetSiteConnectionStringKeyVaultReferenceSlot + /// Description for Gets the config reference and status of an app. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigConnectionString.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetSiteConnectionStringKeyVaultReferenceSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteSlotConfigConnectionString(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigConnectionStringCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigConnectionStringCollection.cs new file mode 100644 index 000000000000..37ab87f85366 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotConfigConnectionStringCollection.cs @@ -0,0 +1,311 @@ +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppService +{ + /// A class representing collection of ApiKeyVaultReference and their operations over its parent. + public partial class SiteSlotConfigConnectionStringCollection : ArmCollection, IEnumerable, IAsyncEnumerable + + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteSlotConfigConnectionStringCollection() + { + } + + /// Initializes a new instance of SiteSlotConfigConnectionStringCollection class. + /// The resource representing the parent resource. + internal SiteSlotConfigConnectionStringCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => SiteSlot.ResourceType; + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/connectionstrings/{connectionStringKey} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetSiteConnectionStringKeyVaultReferenceSlot + /// Description for Gets the config reference and status of an app. + /// The String to use. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string connectionStringKey, CancellationToken cancellationToken = default) + { + if (connectionStringKey == null) + { + throw new ArgumentNullException(nameof(connectionStringKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigConnectionStringCollection.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetSiteConnectionStringKeyVaultReferenceSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connectionStringKey, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteSlotConfigConnectionString(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/connectionstrings/{connectionStringKey} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetSiteConnectionStringKeyVaultReferenceSlot + /// Description for Gets the config reference and status of an app. + /// The String to use. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string connectionStringKey, CancellationToken cancellationToken = default) + { + if (connectionStringKey == null) + { + throw new ArgumentNullException(nameof(connectionStringKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigConnectionStringCollection.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetSiteConnectionStringKeyVaultReferenceSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connectionStringKey, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteSlotConfigConnectionString(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// The String to use. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string connectionStringKey, CancellationToken cancellationToken = default) + { + if (connectionStringKey == null) + { + throw new ArgumentNullException(nameof(connectionStringKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigConnectionStringCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetSiteConnectionStringKeyVaultReferenceSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connectionStringKey, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteSlotConfigConnectionString(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// The String to use. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string connectionStringKey, CancellationToken cancellationToken = default) + { + if (connectionStringKey == null) + { + throw new ArgumentNullException(nameof(connectionStringKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigConnectionStringCollection.GetIfExistsAsync"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetSiteConnectionStringKeyVaultReferenceSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connectionStringKey, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteSlotConfigConnectionString(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// The String to use. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIfExists(string connectionStringKey, CancellationToken cancellationToken = default) + { + if (connectionStringKey == null) + { + throw new ArgumentNullException(nameof(connectionStringKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigConnectionStringCollection.CheckIfExists"); + scope.Start(); + try + { + var response = GetIfExists(connectionStringKey, 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. + /// The String to use. + /// The cancellation token to use. + /// is null. + public async virtual Task> CheckIfExistsAsync(string connectionStringKey, CancellationToken cancellationToken = default) + { + if (connectionStringKey == null) + { + throw new ArgumentNullException(nameof(connectionStringKey)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigConnectionStringCollection.CheckIfExistsAsync"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(connectionStringKey, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/connectionstrings + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetSiteConnectionStringKeyVaultReferencesSlot + /// Description for Gets the config reference app settings and status of an app. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigConnectionStringCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetSiteConnectionStringKeyVaultReferencesSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotConfigConnectionString(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigConnectionStringCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetSiteConnectionStringKeyVaultReferencesSlotNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotConfigConnectionString(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/configreferences/connectionstrings + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetSiteConnectionStringKeyVaultReferencesSlot + /// Description for Gets the config reference app settings and status of an app. + /// 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) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigConnectionStringCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetSiteConnectionStringKeyVaultReferencesSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotConfigConnectionString(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigConnectionStringCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetSiteConnectionStringKeyVaultReferencesSlotNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotConfigConnectionString(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotContinuousWebJob.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotContinuousWebJob.cs new file mode 100644 index 000000000000..3ff252f16f03 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotContinuousWebJob.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AppService +{ + /// A Class representing a SiteSlotContinuousWebJob along with the instance operations that can be performed on it. + public partial class SiteSlotContinuousWebJob : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + private readonly ContinuousWebJobData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteSlotContinuousWebJob() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteSlotContinuousWebJob(ArmResource options, ContinuousWebJobData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// 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 SiteSlotContinuousWebJob(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal SiteSlotContinuousWebJob(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/slots/continuouswebjobs"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// 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 ContinuousWebJobData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_GetContinuousWebJobSlot + /// Description for Gets a continuous web job by its ID for an app, or a deployment slot. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJob.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetContinuousWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteSlotContinuousWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_GetContinuousWebJobSlot + /// Description for Gets a continuous web job by its ID for an app, or a deployment slot. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJob.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetContinuousWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteSlotContinuousWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_DeleteContinuousWebJobSlot + /// Description for Delete a continuous web job by its ID for an app, or a deployment slot. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJob.Delete"); + scope.Start(); + try + { + var response = await _webAppsRestClient.DeleteContinuousWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WebAppDeleteContinuousWebJobSlotOperation(response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_DeleteContinuousWebJobSlot + /// Description for Delete a continuous web job by its ID for an app, or a deployment slot. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WebAppDeleteContinuousWebJobSlotOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJob.Delete"); + scope.Start(); + try + { + var response = _webAppsRestClient.DeleteContinuousWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new WebAppDeleteContinuousWebJobSlotOperation(response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/start + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_StartContinuousWebJobSlot + /// Description for Start a continuous web job for an app, or a deployment slot. + /// The cancellation token to use. + public async virtual Task StartContinuousWebJobSlotAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJob.StartContinuousWebJobSlot"); + scope.Start(); + try + { + var response = await _webAppsRestClient.StartContinuousWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/start + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_StartContinuousWebJobSlot + /// Description for Start a continuous web job for an app, or a deployment slot. + /// The cancellation token to use. + public virtual Response StartContinuousWebJobSlot(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJob.StartContinuousWebJobSlot"); + scope.Start(); + try + { + var response = _webAppsRestClient.StartContinuousWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/stop + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_StopContinuousWebJobSlot + /// Description for Stop a continuous web job for an app, or a deployment slot. + /// The cancellation token to use. + public async virtual Task StopContinuousWebJobSlotAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJob.StopContinuousWebJobSlot"); + scope.Start(); + try + { + var response = await _webAppsRestClient.StopContinuousWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName}/stop + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// OperationId: WebApps_StopContinuousWebJobSlot + /// Description for Stop a continuous web job for an app, or a deployment slot. + /// The cancellation token to use. + public virtual Response StopContinuousWebJobSlot(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJob.StopContinuousWebJobSlot"); + scope.Start(); + try + { + var response = _webAppsRestClient.StopContinuousWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotContinuousWebJobCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotContinuousWebJobCollection.cs new file mode 100644 index 000000000000..f7aea8f3c3c9 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotContinuousWebJobCollection.cs @@ -0,0 +1,311 @@ +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppService +{ + /// A class representing collection of ContinuousWebJob and their operations over its parent. + public partial class SiteSlotContinuousWebJobCollection : ArmCollection, IEnumerable, IAsyncEnumerable + + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteSlotContinuousWebJobCollection() + { + } + + /// Initializes a new instance of SiteSlotContinuousWebJobCollection class. + /// The resource representing the parent resource. + internal SiteSlotContinuousWebJobCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => SiteSlot.ResourceType; + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetContinuousWebJobSlot + /// Description for Gets a continuous web job by its ID for an app, or a deployment slot. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJobCollection.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetContinuousWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteSlotContinuousWebJob(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetContinuousWebJobSlot + /// Description for Gets a continuous web job by its ID for an app, or a deployment slot. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJobCollection.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetContinuousWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteSlotContinuousWebJob(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetContinuousWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteSlotContinuousWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJobCollection.GetIfExistsAsync"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetContinuousWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteSlotContinuousWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIfExists(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJobCollection.CheckIfExists"); + scope.Start(); + try + { + var response = GetIfExists(webJobName, 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. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public async virtual Task> CheckIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJobCollection.CheckIfExistsAsync"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_ListContinuousWebJobsSlot + /// Description for List continuous web jobs for an app, or a deployment slot. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListContinuousWebJobsSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotContinuousWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListContinuousWebJobsSlotNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotContinuousWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/continuouswebjobs + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_ListContinuousWebJobsSlot + /// Description for List continuous web jobs for an app, or a deployment slot. + /// 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) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListContinuousWebJobsSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotContinuousWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotContinuousWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListContinuousWebJobsSlotNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotContinuousWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotExtension.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotExtension.cs index b3ead7613cff..93276260ec6d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotExtension.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotExtension.cs @@ -38,6 +38,7 @@ internal SiteSlotExtension(ArmResource options, MSDeployStatusData resource) : b { HasData = true; _data = resource; + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -47,6 +48,7 @@ internal SiteSlotExtension(ArmResource options, MSDeployStatusData resource) : b /// The identifier of the resource that is the target of operations. internal SiteSlotExtension(ArmResource options, ResourceIdentifier id) : base(options, id) { + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -84,6 +86,9 @@ public virtual MSDeployStatusData Data } } + /// Gets the parent resource of this resource. + public ArmResource Parent { get; } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy /// OperationId: WebApps_GetMSDeployStatusSlot @@ -146,6 +151,70 @@ public virtual IEnumerable GetAvailableLocations(CancellationToken can return ListAvailableLocations(ResourceType, cancellationToken); } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy + /// OperationId: WebApps_CreateMSDeployOperationSlot + /// Description for Invoke the MSDeploy web app extension. + /// Details of MSDeploy operation. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreateOrUpdateAsync(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (msDeploy == null) + { + throw new ArgumentNullException(nameof(msDeploy)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotExtension.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _webAppsRestClient.CreateMSDeployOperationSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, msDeploy, cancellationToken).ConfigureAwait(false); + var operation = new WebAppCreateMSDeployOperationSlotOperation(this, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateMSDeployOperationSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, msDeploy).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy + /// OperationId: WebApps_CreateMSDeployOperationSlot + /// Description for Invoke the MSDeploy web app extension. + /// Details of MSDeploy operation. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WebAppCreateMSDeployOperationSlotOperation CreateOrUpdate(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (msDeploy == null) + { + throw new ArgumentNullException(nameof(msDeploy)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotExtension.CreateOrUpdate"); + scope.Start(); + try + { + var response = _webAppsRestClient.CreateMSDeployOperationSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, msDeploy, cancellationToken); + var operation = new WebAppCreateMSDeployOperationSlotOperation(this, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateMSDeployOperationSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, msDeploy).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy/log /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy /// OperationId: WebApps_GetMSDeployLogSlot diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotExtensionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotExtensionCollection.cs deleted file mode 100644 index 28381e120943..000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotExtensionCollection.cs +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppService.Models; -using Azure.ResourceManager.Core; - -namespace Azure.ResourceManager.AppService -{ - /// A class representing collection of MSDeployStatus and their operations over its parent. - public partial class SiteSlotExtensionCollection : ArmCollection - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly WebAppsRestOperations _webAppsRestClient; - - /// Initializes a new instance of the class for mocking. - protected SiteSlotExtensionCollection() - { - } - - /// Initializes a new instance of SiteSlotExtensionCollection class. - /// The resource representing the parent resource. - internal SiteSlotExtensionCollection(ArmResource parent) : base(parent) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => SiteSlot.ResourceType; - - // Collection level operations. - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} - /// OperationId: WebApps_CreateMSDeployOperationSlot - /// Description for Invoke the MSDeploy web app extension. - /// Details of MSDeploy operation. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WebAppCreateMSDeployOperationSlotOperation CreateOrUpdate(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (msDeploy == null) - { - throw new ArgumentNullException(nameof(msDeploy)); - } - - using var scope = _clientDiagnostics.CreateScope("SiteSlotExtensionCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _webAppsRestClient.CreateMSDeployOperationSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, msDeploy, cancellationToken); - var operation = new WebAppCreateMSDeployOperationSlotOperation(Parent, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateMSDeployOperationSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, msDeploy).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} - /// OperationId: WebApps_CreateMSDeployOperationSlot - /// Description for Invoke the MSDeploy web app extension. - /// Details of MSDeploy operation. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task CreateOrUpdateAsync(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (msDeploy == null) - { - throw new ArgumentNullException(nameof(msDeploy)); - } - - using var scope = _clientDiagnostics.CreateScope("SiteSlotExtensionCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _webAppsRestClient.CreateMSDeployOperationSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, msDeploy, cancellationToken).ConfigureAwait(false); - var operation = new WebAppCreateMSDeployOperationSlotOperation(Parent, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateMSDeployOperationSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, msDeploy).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} - /// OperationId: WebApps_GetMSDeployStatusSlot - /// Description for Get the status of the last MSDeploy operation. - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotExtensionCollection.Get"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetMSDeployStatusSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new SiteSlotExtension(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} - /// OperationId: WebApps_GetMSDeployStatusSlot - /// Description for Get the status of the last MSDeploy operation. - /// The cancellation token to use. - public async virtual Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotExtensionCollection.Get"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetMSDeployStatusSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new SiteSlotExtension(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response GetIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotExtensionCollection.GetIfExists"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetMSDeployStatusSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new SiteSlotExtension(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public async virtual Task> GetIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotExtensionCollection.GetIfExistsAsync"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetMSDeployStatusSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new SiteSlotExtension(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response CheckIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotExtensionCollection.CheckIfExists"); - scope.Start(); - try - { - var response = GetIfExists(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. - /// The cancellation token to use. - public async virtual Task> CheckIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotExtensionCollection.CheckIfExistsAsync"); - scope.Start(); - try - { - var response = await GetIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - // Builders. - // public ArmBuilder Construct() { } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstance.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstance.cs index d6c655423cb4..8dd0c7605a11 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstance.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstance.cs @@ -147,11 +147,11 @@ public virtual IEnumerable GetAvailableLocations(CancellationToken can #region SiteSlotInstanceExtension - /// Gets a collection of SiteSlotInstanceExtensions in the SiteSlotInstance. - /// An object representing collection of SiteSlotInstanceExtensions and their operations over a SiteSlotInstance. - public SiteSlotInstanceExtensionCollection GetSiteSlotInstanceExtensions() + /// Gets an object representing a SiteSlotInstanceExtension along with the instance operations that can be performed on it in the SiteSlotInstance. + /// Returns a object. + public SiteSlotInstanceExtension GetSiteSlotInstanceExtension() { - return new SiteSlotInstanceExtensionCollection(this); + return new SiteSlotInstanceExtension(this, new ResourceIdentifier(Id.ToString() + "/extensions/MSDeploy")); } #endregion diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceExtension.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceExtension.cs index 8de318b495f2..e8766bcccdf4 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceExtension.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceExtension.cs @@ -38,6 +38,7 @@ internal SiteSlotInstanceExtension(ArmResource options, MSDeployStatusData resou { HasData = true; _data = resource; + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -47,6 +48,7 @@ internal SiteSlotInstanceExtension(ArmResource options, MSDeployStatusData resou /// The identifier of the resource that is the target of operations. internal SiteSlotInstanceExtension(ArmResource options, ResourceIdentifier id) : base(options, id) { + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -84,6 +86,9 @@ public virtual MSDeployStatusData Data } } + /// Gets the parent resource of this resource. + public ArmResource Parent { get; } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy /// OperationId: WebApps_GetInstanceMsDeployStatusSlot @@ -146,6 +151,70 @@ public virtual IEnumerable GetAvailableLocations(CancellationToken can return ListAvailableLocations(ResourceType, cancellationToken); } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy + /// OperationId: WebApps_CreateInstanceMSDeployOperationSlot + /// Description for Invoke the MSDeploy web app extension. + /// Details of MSDeploy operation. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreateOrUpdateAsync(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (msDeploy == null) + { + throw new ArgumentNullException(nameof(msDeploy)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotInstanceExtension.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _webAppsRestClient.CreateInstanceMSDeployOperationSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, msDeploy, cancellationToken).ConfigureAwait(false); + var operation = new WebAppCreateInstanceMSDeployOperationSlotOperation(this, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateInstanceMSDeployOperationSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, msDeploy).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy + /// OperationId: WebApps_CreateInstanceMSDeployOperationSlot + /// Description for Invoke the MSDeploy web app extension. + /// Details of MSDeploy operation. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WebAppCreateInstanceMSDeployOperationSlotOperation CreateOrUpdate(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (msDeploy == null) + { + throw new ArgumentNullException(nameof(msDeploy)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotInstanceExtension.CreateOrUpdate"); + scope.Start(); + try + { + var response = _webAppsRestClient.CreateInstanceMSDeployOperationSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, msDeploy, cancellationToken); + var operation = new WebAppCreateInstanceMSDeployOperationSlotOperation(this, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateInstanceMSDeployOperationSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, msDeploy).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy/log /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy /// OperationId: WebApps_GetInstanceMSDeployLogSlot diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceExtensionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceExtensionCollection.cs deleted file mode 100644 index ea6651ec1af5..000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceExtensionCollection.cs +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppService.Models; -using Azure.ResourceManager.Core; - -namespace Azure.ResourceManager.AppService -{ - /// A class representing collection of MSDeployStatus and their operations over its parent. - public partial class SiteSlotInstanceExtensionCollection : ArmCollection - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly WebAppsRestOperations _webAppsRestClient; - - /// Initializes a new instance of the class for mocking. - protected SiteSlotInstanceExtensionCollection() - { - } - - /// Initializes a new instance of SiteSlotInstanceExtensionCollection class. - /// The resource representing the parent resource. - internal SiteSlotInstanceExtensionCollection(ArmResource parent) : base(parent) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => SiteSlotInstance.ResourceType; - - // Collection level operations. - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId} - /// OperationId: WebApps_CreateInstanceMSDeployOperationSlot - /// Description for Invoke the MSDeploy web app extension. - /// Details of MSDeploy operation. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WebAppCreateInstanceMSDeployOperationSlotOperation CreateOrUpdate(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (msDeploy == null) - { - throw new ArgumentNullException(nameof(msDeploy)); - } - - using var scope = _clientDiagnostics.CreateScope("SiteSlotInstanceExtensionCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _webAppsRestClient.CreateInstanceMSDeployOperationSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, msDeploy, cancellationToken); - var operation = new WebAppCreateInstanceMSDeployOperationSlotOperation(Parent, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateInstanceMSDeployOperationSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, msDeploy).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId} - /// OperationId: WebApps_CreateInstanceMSDeployOperationSlot - /// Description for Invoke the MSDeploy web app extension. - /// Details of MSDeploy operation. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task CreateOrUpdateAsync(MsDeploy msDeploy, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (msDeploy == null) - { - throw new ArgumentNullException(nameof(msDeploy)); - } - - using var scope = _clientDiagnostics.CreateScope("SiteSlotInstanceExtensionCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _webAppsRestClient.CreateInstanceMSDeployOperationSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, msDeploy, cancellationToken).ConfigureAwait(false); - var operation = new WebAppCreateInstanceMSDeployOperationSlotOperation(Parent, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateInstanceMSDeployOperationSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, msDeploy).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId} - /// OperationId: WebApps_GetInstanceMsDeployStatusSlot - /// Description for Get the status of the last MSDeploy operation. - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotInstanceExtensionCollection.Get"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetInstanceMsDeployStatusSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new SiteSlotInstanceExtension(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId}/extensions/MSDeploy - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/instances/{instanceId} - /// OperationId: WebApps_GetInstanceMsDeployStatusSlot - /// Description for Get the status of the last MSDeploy operation. - /// The cancellation token to use. - public async virtual Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotInstanceExtensionCollection.Get"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetInstanceMsDeployStatusSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new SiteSlotInstanceExtension(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response GetIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotInstanceExtensionCollection.GetIfExists"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetInstanceMsDeployStatusSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new SiteSlotInstanceExtension(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public async virtual Task> GetIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotInstanceExtensionCollection.GetIfExistsAsync"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetInstanceMsDeployStatusSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new SiteSlotInstanceExtension(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response CheckIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotInstanceExtensionCollection.CheckIfExists"); - scope.Start(); - try - { - var response = GetIfExists(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. - /// The cancellation token to use. - public async virtual Task> CheckIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotInstanceExtensionCollection.CheckIfExistsAsync"); - scope.Start(); - try - { - var response = await GetIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - // Builders. - // public ArmBuilder Construct() { } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPremierAddOn.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPremierAddOn.cs new file mode 100644 index 000000000000..aa17f69fb3ce --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPremierAddOn.cs @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AppService +{ + /// A Class representing a SiteSlotPremierAddOn along with the instance operations that can be performed on it. + public partial class SiteSlotPremierAddOn : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + private readonly PremierAddOnData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteSlotPremierAddOn() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteSlotPremierAddOn(ArmResource options, PremierAddOnData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// 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 SiteSlotPremierAddOn(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal SiteSlotPremierAddOn(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/slots/premieraddons"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// 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 PremierAddOnData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// OperationId: WebApps_GetPremierAddOnSlot + /// Description for Gets a named add-on of an app. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotPremierAddOn.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetPremierAddOnSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteSlotPremierAddOn(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// OperationId: WebApps_GetPremierAddOnSlot + /// Description for Gets a named add-on of an app. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotPremierAddOn.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetPremierAddOnSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteSlotPremierAddOn(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// OperationId: WebApps_DeletePremierAddOnSlot + /// Description for Delete a premier add-on from an app. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotPremierAddOn.Delete"); + scope.Start(); + try + { + var response = await _webAppsRestClient.DeletePremierAddOnSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WebAppDeletePremierAddOnSlotOperation(response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// OperationId: WebApps_DeletePremierAddOnSlot + /// Description for Delete a premier add-on from an app. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WebAppDeletePremierAddOnSlotOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotPremierAddOn.Delete"); + scope.Start(); + try + { + var response = _webAppsRestClient.DeletePremierAddOnSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new WebAppDeletePremierAddOnSlotOperation(response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// OperationId: WebApps_UpdatePremierAddOnSlot + /// Description for Updates a named add-on of an app. + /// A JSON representation of the edited premier add-on. + /// The cancellation token to use. + /// is null. + public async virtual Task> UpdateAsync(PremierAddOnPatchResource premierAddOn, CancellationToken cancellationToken = default) + { + if (premierAddOn == null) + { + throw new ArgumentNullException(nameof(premierAddOn)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotPremierAddOn.Update"); + scope.Start(); + try + { + var response = await _webAppsRestClient.UpdatePremierAddOnSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, premierAddOn, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteSlotPremierAddOn(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// OperationId: WebApps_UpdatePremierAddOnSlot + /// Description for Updates a named add-on of an app. + /// A JSON representation of the edited premier add-on. + /// The cancellation token to use. + /// is null. + public virtual Response Update(PremierAddOnPatchResource premierAddOn, CancellationToken cancellationToken = default) + { + if (premierAddOn == null) + { + throw new ArgumentNullException(nameof(premierAddOn)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotPremierAddOn.Update"); + scope.Start(); + try + { + var response = _webAppsRestClient.UpdatePremierAddOnSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, premierAddOn, cancellationToken); + return Response.FromValue(new SiteSlotPremierAddOn(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPremierAddOnCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPremierAddOnCollection.cs new file mode 100644 index 000000000000..59f21e78c99b --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPremierAddOnCollection.cs @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppService +{ + /// A class representing collection of PremierAddOn and their operations over its parent. + public partial class SiteSlotPremierAddOnCollection : ArmCollection + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteSlotPremierAddOnCollection() + { + } + + /// Initializes a new instance of SiteSlotPremierAddOnCollection class. + /// The resource representing the parent resource. + internal SiteSlotPremierAddOnCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => SiteSlot.ResourceType; + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_AddPremierAddOnSlot + /// Description for Updates a named add-on of an app. + /// Add-on name. + /// A JSON representation of the edited premier add-on. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual WebAppAddPremierAddOnSlotOperation CreateOrUpdate(string premierAddOnName, PremierAddOnData premierAddOn, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + if (premierAddOn == null) + { + throw new ArgumentNullException(nameof(premierAddOn)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotPremierAddOnCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _webAppsRestClient.AddPremierAddOnSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, premierAddOnName, premierAddOn, cancellationToken); + var operation = new WebAppAddPremierAddOnSlotOperation(Parent, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_AddPremierAddOnSlot + /// Description for Updates a named add-on of an app. + /// Add-on name. + /// A JSON representation of the edited premier add-on. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(string premierAddOnName, PremierAddOnData premierAddOn, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + if (premierAddOn == null) + { + throw new ArgumentNullException(nameof(premierAddOn)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotPremierAddOnCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _webAppsRestClient.AddPremierAddOnSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, premierAddOnName, premierAddOn, cancellationToken).ConfigureAwait(false); + var operation = new WebAppAddPremierAddOnSlotOperation(Parent, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetPremierAddOnSlot + /// Description for Gets a named add-on of an app. + /// Add-on name. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string premierAddOnName, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotPremierAddOnCollection.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetPremierAddOnSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, premierAddOnName, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteSlotPremierAddOn(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/premieraddons/{premierAddOnName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetPremierAddOnSlot + /// Description for Gets a named add-on of an app. + /// Add-on name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string premierAddOnName, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotPremierAddOnCollection.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetPremierAddOnSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, premierAddOnName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteSlotPremierAddOn(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Add-on name. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string premierAddOnName, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotPremierAddOnCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetPremierAddOnSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, premierAddOnName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteSlotPremierAddOn(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Add-on name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string premierAddOnName, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotPremierAddOnCollection.GetIfExistsAsync"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetPremierAddOnSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, premierAddOnName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteSlotPremierAddOn(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Add-on name. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIfExists(string premierAddOnName, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotPremierAddOnCollection.CheckIfExists"); + scope.Start(); + try + { + var response = GetIfExists(premierAddOnName, 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. + /// Add-on name. + /// The cancellation token to use. + /// is null. + public async virtual Task> CheckIfExistsAsync(string premierAddOnName, CancellationToken cancellationToken = default) + { + if (premierAddOnName == null) + { + throw new ArgumentNullException(nameof(premierAddOnName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotPremierAddOnCollection.CheckIfExistsAsync"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(premierAddOnName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPrivateAccess.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPrivateAccess.cs index 4ae2ae9e1d26..82a604a741e5 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPrivateAccess.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPrivateAccess.cs @@ -13,6 +13,7 @@ using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager; +using Azure.ResourceManager.AppService.Models; using Azure.ResourceManager.Core; using Azure.ResourceManager.Resources.Models; @@ -37,6 +38,7 @@ internal SiteSlotPrivateAccess(ArmResource options, PrivateAccessData resource) { HasData = true; _data = resource; + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -46,6 +48,7 @@ internal SiteSlotPrivateAccess(ArmResource options, PrivateAccessData resource) /// The identifier of the resource that is the target of operations. internal SiteSlotPrivateAccess(ArmResource options, ResourceIdentifier id) : base(options, id) { + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -83,6 +86,9 @@ public virtual PrivateAccessData Data } } + /// Gets the parent resource of this resource. + public ArmResource Parent { get; } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks /// OperationId: WebApps_GetPrivateAccessSlot @@ -144,5 +150,69 @@ public virtual IEnumerable GetAvailableLocations(CancellationToken can { return ListAvailableLocations(ResourceType, cancellationToken); } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks + /// OperationId: WebApps_PutPrivateAccessVnetSlot + /// Description for Sets data around private site access enablement and authorized Virtual Networks that can access the site. + /// The information for the private access. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreateOrUpdateAsync(PrivateAccessData access, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (access == null) + { + throw new ArgumentNullException(nameof(access)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotPrivateAccess.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _webAppsRestClient.PutPrivateAccessVnetSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, access, cancellationToken).ConfigureAwait(false); + var operation = new WebAppPutPrivateAccessVnetSlotOperation(this, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks + /// OperationId: WebApps_PutPrivateAccessVnetSlot + /// Description for Sets data around private site access enablement and authorized Virtual Networks that can access the site. + /// The information for the private access. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WebAppPutPrivateAccessVnetSlotOperation CreateOrUpdate(PrivateAccessData access, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (access == null) + { + throw new ArgumentNullException(nameof(access)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotPrivateAccess.CreateOrUpdate"); + scope.Start(); + try + { + var response = _webAppsRestClient.PutPrivateAccessVnetSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, access, cancellationToken); + var operation = new WebAppPutPrivateAccessVnetSlotOperation(this, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPrivateAccessCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPrivateAccessCollection.cs deleted file mode 100644 index ee271305d633..000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotPrivateAccessCollection.cs +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppService.Models; -using Azure.ResourceManager.Core; - -namespace Azure.ResourceManager.AppService -{ - /// A class representing collection of PrivateAccess and their operations over its parent. - public partial class SiteSlotPrivateAccessCollection : ArmCollection - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly WebAppsRestOperations _webAppsRestClient; - - /// Initializes a new instance of the class for mocking. - protected SiteSlotPrivateAccessCollection() - { - } - - /// Initializes a new instance of SiteSlotPrivateAccessCollection class. - /// The resource representing the parent resource. - internal SiteSlotPrivateAccessCollection(ArmResource parent) : base(parent) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => SiteSlot.ResourceType; - - // Collection level operations. - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} - /// OperationId: WebApps_PutPrivateAccessVnetSlot - /// Description for Sets data around private site access enablement and authorized Virtual Networks that can access the site. - /// The information for the private access. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WebAppPutPrivateAccessVnetSlotOperation CreateOrUpdate(PrivateAccessData access, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (access == null) - { - throw new ArgumentNullException(nameof(access)); - } - - using var scope = _clientDiagnostics.CreateScope("SiteSlotPrivateAccessCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _webAppsRestClient.PutPrivateAccessVnetSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, access, cancellationToken); - var operation = new WebAppPutPrivateAccessVnetSlotOperation(Parent, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} - /// OperationId: WebApps_PutPrivateAccessVnetSlot - /// Description for Sets data around private site access enablement and authorized Virtual Networks that can access the site. - /// The information for the private access. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task CreateOrUpdateAsync(PrivateAccessData access, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (access == null) - { - throw new ArgumentNullException(nameof(access)); - } - - using var scope = _clientDiagnostics.CreateScope("SiteSlotPrivateAccessCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _webAppsRestClient.PutPrivateAccessVnetSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, access, cancellationToken).ConfigureAwait(false); - var operation = new WebAppPutPrivateAccessVnetSlotOperation(Parent, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} - /// OperationId: WebApps_GetPrivateAccessSlot - /// Description for Gets data around private site access enablement and authorized Virtual Networks that can access the site. - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotPrivateAccessCollection.Get"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetPrivateAccessSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new SiteSlotPrivateAccess(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/privateAccess/virtualNetworks - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} - /// OperationId: WebApps_GetPrivateAccessSlot - /// Description for Gets data around private site access enablement and authorized Virtual Networks that can access the site. - /// The cancellation token to use. - public async virtual Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotPrivateAccessCollection.Get"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetPrivateAccessSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new SiteSlotPrivateAccess(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response GetIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotPrivateAccessCollection.GetIfExists"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetPrivateAccessSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new SiteSlotPrivateAccess(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public async virtual Task> GetIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotPrivateAccessCollection.GetIfExistsAsync"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetPrivateAccessSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new SiteSlotPrivateAccess(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response CheckIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotPrivateAccessCollection.CheckIfExists"); - scope.Start(); - try - { - var response = GetIfExists(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. - /// The cancellation token to use. - public async virtual Task> CheckIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotPrivateAccessCollection.CheckIfExistsAsync"); - scope.Start(); - try - { - var response = await GetIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - // Builders. - // public ArmBuilder Construct() { } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotSourcecontrol.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotSourcecontrol.cs index c5297c007f4b..b1b9bc40d77f 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotSourcecontrol.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotSourcecontrol.cs @@ -38,6 +38,7 @@ internal SiteSlotSourcecontrol(ArmResource options, SiteSourceControlData resour { HasData = true; _data = resource; + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -47,6 +48,7 @@ internal SiteSlotSourcecontrol(ArmResource options, SiteSourceControlData resour /// The identifier of the resource that is the target of operations. internal SiteSlotSourcecontrol(ArmResource options, ResourceIdentifier id) : base(options, id) { + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -84,6 +86,9 @@ public virtual SiteSourceControlData Data } } + /// Gets the parent resource of this resource. + public ArmResource Parent { get; } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web /// OperationId: WebApps_GetSourceControlSlot @@ -198,6 +203,70 @@ public virtual WebAppDeleteSourceControlSlotOperation Delete(string additionalFl } } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web + /// OperationId: WebApps_CreateOrUpdateSourceControlSlot + /// Description for Updates the source control configuration of an app. + /// JSON representation of a SiteSourceControl object. See example. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreateOrUpdateAsync(SiteSourceControlData siteSourceControl, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (siteSourceControl == null) + { + throw new ArgumentNullException(nameof(siteSourceControl)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotSourcecontrol.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _webAppsRestClient.CreateOrUpdateSourceControlSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, siteSourceControl, cancellationToken).ConfigureAwait(false); + var operation = new WebAppCreateOrUpdateSourceControlSlotOperation(this, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateOrUpdateSourceControlSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, siteSourceControl).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web + /// OperationId: WebApps_CreateOrUpdateSourceControlSlot + /// Description for Updates the source control configuration of an app. + /// JSON representation of a SiteSourceControl object. See example. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WebAppCreateOrUpdateSourceControlSlotOperation CreateOrUpdate(SiteSourceControlData siteSourceControl, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (siteSourceControl == null) + { + throw new ArgumentNullException(nameof(siteSourceControl)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotSourcecontrol.CreateOrUpdate"); + scope.Start(); + try + { + var response = _webAppsRestClient.CreateOrUpdateSourceControlSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, siteSourceControl, cancellationToken); + var operation = new WebAppCreateOrUpdateSourceControlSlotOperation(this, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateOrUpdateSourceControlSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, siteSourceControl).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web /// OperationId: WebApps_UpdateSourceControlSlot diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotSourcecontrolCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotSourcecontrolCollection.cs deleted file mode 100644 index 0f23b9be0d1d..000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotSourcecontrolCollection.cs +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppService.Models; -using Azure.ResourceManager.Core; - -namespace Azure.ResourceManager.AppService -{ - /// A class representing collection of SiteSourceControl and their operations over its parent. - public partial class SiteSlotSourcecontrolCollection : ArmCollection - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly WebAppsRestOperations _webAppsRestClient; - - /// Initializes a new instance of the class for mocking. - protected SiteSlotSourcecontrolCollection() - { - } - - /// Initializes a new instance of SiteSlotSourcecontrolCollection class. - /// The resource representing the parent resource. - internal SiteSlotSourcecontrolCollection(ArmResource parent) : base(parent) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => SiteSlot.ResourceType; - - // Collection level operations. - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} - /// OperationId: WebApps_CreateOrUpdateSourceControlSlot - /// Description for Updates the source control configuration of an app. - /// JSON representation of a SiteSourceControl object. See example. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WebAppCreateOrUpdateSourceControlSlotOperation CreateOrUpdate(SiteSourceControlData siteSourceControl, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (siteSourceControl == null) - { - throw new ArgumentNullException(nameof(siteSourceControl)); - } - - using var scope = _clientDiagnostics.CreateScope("SiteSlotSourcecontrolCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _webAppsRestClient.CreateOrUpdateSourceControlSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, siteSourceControl, cancellationToken); - var operation = new WebAppCreateOrUpdateSourceControlSlotOperation(Parent, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateOrUpdateSourceControlSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, siteSourceControl).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} - /// OperationId: WebApps_CreateOrUpdateSourceControlSlot - /// Description for Updates the source control configuration of an app. - /// JSON representation of a SiteSourceControl object. See example. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task CreateOrUpdateAsync(SiteSourceControlData siteSourceControl, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (siteSourceControl == null) - { - throw new ArgumentNullException(nameof(siteSourceControl)); - } - - using var scope = _clientDiagnostics.CreateScope("SiteSlotSourcecontrolCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _webAppsRestClient.CreateOrUpdateSourceControlSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, siteSourceControl, cancellationToken).ConfigureAwait(false); - var operation = new WebAppCreateOrUpdateSourceControlSlotOperation(Parent, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateOrUpdateSourceControlSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, siteSourceControl).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} - /// OperationId: WebApps_GetSourceControlSlot - /// Description for Gets the source control configuration of an app. - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotSourcecontrolCollection.Get"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetSourceControlSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new SiteSlotSourcecontrol(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/sourcecontrols/web - /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} - /// OperationId: WebApps_GetSourceControlSlot - /// Description for Gets the source control configuration of an app. - /// The cancellation token to use. - public async virtual Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotSourcecontrolCollection.Get"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetSourceControlSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new SiteSlotSourcecontrol(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response GetIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotSourcecontrolCollection.GetIfExists"); - scope.Start(); - try - { - var response = _webAppsRestClient.GetSourceControlSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new SiteSlotSourcecontrol(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public async virtual Task> GetIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotSourcecontrolCollection.GetIfExistsAsync"); - scope.Start(); - try - { - var response = await _webAppsRestClient.GetSourceControlSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new SiteSlotSourcecontrol(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response CheckIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotSourcecontrolCollection.CheckIfExists"); - scope.Start(); - try - { - var response = GetIfExists(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. - /// The cancellation token to use. - public async virtual Task> CheckIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("SiteSlotSourcecontrolCollection.CheckIfExistsAsync"); - scope.Start(); - try - { - var response = await GetIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - // Builders. - // public ArmBuilder Construct() { } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotTriggeredWebJob.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotTriggeredWebJob.cs new file mode 100644 index 000000000000..ea4732bb9ef6 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotTriggeredWebJob.cs @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AppService +{ + /// A Class representing a SiteSlotTriggeredWebJob along with the instance operations that can be performed on it. + public partial class SiteSlotTriggeredWebJob : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + private readonly TriggeredWebJobData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteSlotTriggeredWebJob() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteSlotTriggeredWebJob(ArmResource options, TriggeredWebJobData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// 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 SiteSlotTriggeredWebJob(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal SiteSlotTriggeredWebJob(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/triggeredwebjobs"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// 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 TriggeredWebJobData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_GetTriggeredWebJob + /// Description for Gets a triggered web job by its ID for an app, or a deployment slot. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJob.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetTriggeredWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteSlotTriggeredWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_GetTriggeredWebJob + /// Description for Gets a triggered web job by its ID for an app, or a deployment slot. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJob.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetTriggeredWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteSlotTriggeredWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_DeleteTriggeredWebJob + /// Description for Delete a triggered web job by its ID for an app, or a deployment slot. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJob.Delete"); + scope.Start(); + try + { + var response = await _webAppsRestClient.DeleteTriggeredWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WebAppDeleteTriggeredWebJobOperation(response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_DeleteTriggeredWebJob + /// Description for Delete a triggered web job by its ID for an app, or a deployment slot. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WebAppDeleteTriggeredWebJobOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJob.Delete"); + scope.Start(); + try + { + var response = _webAppsRestClient.DeleteTriggeredWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new WebAppDeleteTriggeredWebJobOperation(response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/run + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_RunTriggeredWebJob + /// Description for Run a triggered web job for an app, or a deployment slot. + /// The cancellation token to use. + public async virtual Task RunAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJob.Run"); + scope.Start(); + try + { + var response = await _webAppsRestClient.RunTriggeredWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/run + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_RunTriggeredWebJob + /// Description for Run a triggered web job for an app, or a deployment slot. + /// The cancellation token to use. + public virtual Response Run(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJob.Run"); + scope.Start(); + try + { + var response = _webAppsRestClient.RunTriggeredWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + #region SiteSlotTriggeredWebJobHistory + + /// Gets a collection of SiteSlotTriggeredWebJobHistories in the SiteSlotTriggeredWebJob. + /// An object representing collection of SiteSlotTriggeredWebJobHistories and their operations over a SiteSlotTriggeredWebJob. + public SiteSlotTriggeredWebJobHistoryCollection GetSiteSlotTriggeredWebJobHistories() + { + return new SiteSlotTriggeredWebJobHistoryCollection(this); + } + #endregion + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotTriggeredWebJobCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotTriggeredWebJobCollection.cs new file mode 100644 index 000000000000..7af35e23c5ae --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotTriggeredWebJobCollection.cs @@ -0,0 +1,311 @@ +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppService +{ + /// A class representing collection of TriggeredWebJob and their operations over its parent. + public partial class SiteSlotTriggeredWebJobCollection : ArmCollection, IEnumerable, IAsyncEnumerable + + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteSlotTriggeredWebJobCollection() + { + } + + /// Initializes a new instance of SiteSlotTriggeredWebJobCollection class. + /// The resource representing the parent resource. + internal SiteSlotTriggeredWebJobCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => WebSite.ResourceType; + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_GetTriggeredWebJob + /// Description for Gets a triggered web job by its ID for an app, or a deployment slot. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobCollection.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetTriggeredWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteSlotTriggeredWebJob(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_GetTriggeredWebJob + /// Description for Gets a triggered web job by its ID for an app, or a deployment slot. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobCollection.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetTriggeredWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteSlotTriggeredWebJob(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetTriggeredWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteSlotTriggeredWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobCollection.GetIfExistsAsync"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetTriggeredWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteSlotTriggeredWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIfExists(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobCollection.CheckIfExists"); + scope.Start(); + try + { + var response = GetIfExists(webJobName, 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. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public async virtual Task> CheckIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobCollection.CheckIfExistsAsync"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_ListTriggeredWebJobs + /// Description for List triggered web jobs for an app, or a deployment slot. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListTriggeredWebJobs(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotTriggeredWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListTriggeredWebJobsNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotTriggeredWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_ListTriggeredWebJobs + /// Description for List triggered web jobs for an app, or a deployment slot. + /// 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) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListTriggeredWebJobsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotTriggeredWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListTriggeredWebJobsNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotTriggeredWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotTriggeredWebJobHistory.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotTriggeredWebJobHistory.cs new file mode 100644 index 000000000000..a787fac8aa5e --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotTriggeredWebJobHistory.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AppService +{ + /// A Class representing a SiteSlotTriggeredWebJobHistory along with the instance operations that can be performed on it. + public partial class SiteSlotTriggeredWebJobHistory : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + private readonly TriggeredJobHistoryData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteSlotTriggeredWebJobHistory() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteSlotTriggeredWebJobHistory(ArmResource options, TriggeredJobHistoryData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// 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 SiteSlotTriggeredWebJobHistory(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal SiteSlotTriggeredWebJobHistory(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/triggeredwebjobs/history"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// 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 TriggeredJobHistoryData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id} + /// OperationId: WebApps_GetTriggeredWebJobHistory + /// Description for Gets a triggered web job's history by its ID for an app, , or a deployment slot. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobHistory.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetTriggeredWebJobHistoryAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteSlotTriggeredWebJobHistory(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id} + /// OperationId: WebApps_GetTriggeredWebJobHistory + /// Description for Gets a triggered web job's history by its ID for an app, , or a deployment slot. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobHistory.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetTriggeredWebJobHistory(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteSlotTriggeredWebJobHistory(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotTriggeredWebJobHistoryCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotTriggeredWebJobHistoryCollection.cs new file mode 100644 index 000000000000..5e03fd0aec06 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotTriggeredWebJobHistoryCollection.cs @@ -0,0 +1,311 @@ +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppService +{ + /// A class representing collection of TriggeredJobHistory and their operations over its parent. + public partial class SiteSlotTriggeredWebJobHistoryCollection : ArmCollection, IEnumerable, IAsyncEnumerable + + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteSlotTriggeredWebJobHistoryCollection() + { + } + + /// Initializes a new instance of SiteSlotTriggeredWebJobHistoryCollection class. + /// The resource representing the parent resource. + internal SiteSlotTriggeredWebJobHistoryCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => SiteSlotTriggeredWebJob.ResourceType; + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_GetTriggeredWebJobHistory + /// Description for Gets a triggered web job's history by its ID for an app, , or a deployment slot. + /// History ID. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string id, CancellationToken cancellationToken = default) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobHistoryCollection.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetTriggeredWebJobHistory(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteSlotTriggeredWebJobHistory(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history/{id} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_GetTriggeredWebJobHistory + /// Description for Gets a triggered web job's history by its ID for an app, , or a deployment slot. + /// History ID. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string id, CancellationToken cancellationToken = default) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobHistoryCollection.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetTriggeredWebJobHistoryAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteSlotTriggeredWebJobHistory(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// History ID. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string id, CancellationToken cancellationToken = default) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobHistoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetTriggeredWebJobHistory(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteSlotTriggeredWebJobHistory(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// History ID. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string id, CancellationToken cancellationToken = default) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobHistoryCollection.GetIfExistsAsync"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetTriggeredWebJobHistoryAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, id, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteSlotTriggeredWebJobHistory(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// History ID. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIfExists(string id, CancellationToken cancellationToken = default) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobHistoryCollection.CheckIfExists"); + scope.Start(); + try + { + var response = GetIfExists(id, 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. + /// History ID. + /// The cancellation token to use. + /// is null. + public async virtual Task> CheckIfExistsAsync(string id, CancellationToken cancellationToken = default) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobHistoryCollection.CheckIfExistsAsync"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_ListTriggeredWebJobHistory + /// Description for List a triggered web job's history for an app, or a deployment slot. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobHistoryCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListTriggeredWebJobHistory(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotTriggeredWebJobHistory(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobHistoryCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListTriggeredWebJobHistoryNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotTriggeredWebJobHistory(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/history + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_ListTriggeredWebJobHistory + /// Description for List a triggered web job's history for an app, or a deployment slot. + /// 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) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobHistoryCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListTriggeredWebJobHistoryAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotTriggeredWebJobHistory(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotTriggeredWebJobHistoryCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListTriggeredWebJobHistoryNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotTriggeredWebJobHistory(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotWebJob.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotWebJob.cs new file mode 100644 index 000000000000..adfe4b5a3f75 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotWebJob.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AppService +{ + /// A Class representing a SiteSlotWebJob along with the instance operations that can be performed on it. + public partial class SiteSlotWebJob : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + private readonly WebJobData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteSlotWebJob() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteSlotWebJob(ArmResource options, WebJobData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// 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 SiteSlotWebJob(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal SiteSlotWebJob(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/slots/webjobs"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// 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 WebJobData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName} + /// OperationId: WebApps_GetWebJobSlot + /// Description for Get webjob information for an app, or a deployment slot. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotWebJob.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteSlotWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName} + /// OperationId: WebApps_GetWebJobSlot + /// Description for Get webjob information for an app, or a deployment slot. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotWebJob.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteSlotWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotWebJobCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotWebJobCollection.cs new file mode 100644 index 000000000000..80565b6cecce --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotWebJobCollection.cs @@ -0,0 +1,311 @@ +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppService +{ + /// A class representing collection of WebJob and their operations over its parent. + public partial class SiteSlotWebJobCollection : ArmCollection, IEnumerable, IAsyncEnumerable + + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteSlotWebJobCollection() + { + } + + /// Initializes a new instance of SiteSlotWebJobCollection class. + /// The resource representing the parent resource. + internal SiteSlotWebJobCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => SiteSlot.ResourceType; + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetWebJobSlot + /// Description for Get webjob information for an app, or a deployment slot. + /// Name of the web job. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotWebJobCollection.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteSlotWebJob(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetWebJobSlot + /// Description for Get webjob information for an app, or a deployment slot. + /// Name of the web job. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotWebJobCollection.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteSlotWebJob(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the web job. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotWebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteSlotWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the web job. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotWebJobCollection.GetIfExistsAsync"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteSlotWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the web job. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIfExists(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotWebJobCollection.CheckIfExists"); + scope.Start(); + try + { + var response = GetIfExists(webJobName, 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. + /// Name of the web job. + /// The cancellation token to use. + /// is null. + public async virtual Task> CheckIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSlotWebJobCollection.CheckIfExistsAsync"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_ListWebJobsSlot + /// Description for List webjobs for an app, or a deployment slot. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListWebJobsSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListWebJobsSlotNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/webjobs + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_ListWebJobsSlot + /// Description for List webjobs for an app, or a deployment slot. + /// 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) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListWebJobsSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteSlotWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListWebJobsSlotNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteSlotWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSourceControl.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSourceControl.cs new file mode 100644 index 000000000000..efeef8b6fd01 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSourceControl.cs @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AppService +{ + /// A Class representing a SiteSourceControl along with the instance operations that can be performed on it. + public partial class SiteSourceControl : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + private readonly SiteSourceControlData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteSourceControl() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteSourceControl(ArmResource options, SiteSourceControlData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + Parent = options; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// 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 SiteSourceControl(ArmResource options, ResourceIdentifier id) : base(options, id) + { + Parent = options; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal SiteSourceControl(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/sourcecontrols"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// 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 SiteSourceControlData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// Gets the parent resource of this resource. + public ArmResource Parent { get; } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// OperationId: WebApps_GetSourceControl + /// Description for Gets the source control configuration of an app. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSourceControl.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetSourceControlAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteSourceControl(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// OperationId: WebApps_GetSourceControl + /// Description for Gets the source control configuration of an app. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSourceControl.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetSourceControl(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteSourceControl(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// OperationId: WebApps_DeleteSourceControl + /// Description for Deletes the source control configuration of an app. + /// The String to use. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(string additionalFlags = null, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSourceControl.Delete"); + scope.Start(); + try + { + var response = await _webAppsRestClient.DeleteSourceControlAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, additionalFlags, cancellationToken).ConfigureAwait(false); + var operation = new WebAppDeleteSourceControlOperation(response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// OperationId: WebApps_DeleteSourceControl + /// Description for Deletes the source control configuration of an app. + /// The String to use. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WebAppDeleteSourceControlOperation Delete(string additionalFlags = null, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteSourceControl.Delete"); + scope.Start(); + try + { + var response = _webAppsRestClient.DeleteSourceControl(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, additionalFlags, cancellationToken); + var operation = new WebAppDeleteSourceControlOperation(response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// OperationId: WebApps_CreateOrUpdateSourceControl + /// Description for Updates the source control configuration of an app. + /// JSON representation of a SiteSourceControl object. See example. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreateOrUpdateAsync(SiteSourceControlData siteSourceControl, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (siteSourceControl == null) + { + throw new ArgumentNullException(nameof(siteSourceControl)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSourceControl.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _webAppsRestClient.CreateOrUpdateSourceControlAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, siteSourceControl, cancellationToken).ConfigureAwait(false); + var operation = new WebAppCreateOrUpdateSourceControlOperation(this, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateOrUpdateSourceControlRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, siteSourceControl).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// OperationId: WebApps_CreateOrUpdateSourceControl + /// Description for Updates the source control configuration of an app. + /// JSON representation of a SiteSourceControl object. See example. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WebAppCreateOrUpdateSourceControlOperation CreateOrUpdate(SiteSourceControlData siteSourceControl, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (siteSourceControl == null) + { + throw new ArgumentNullException(nameof(siteSourceControl)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSourceControl.CreateOrUpdate"); + scope.Start(); + try + { + var response = _webAppsRestClient.CreateOrUpdateSourceControl(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, siteSourceControl, cancellationToken); + var operation = new WebAppCreateOrUpdateSourceControlOperation(this, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateOrUpdateSourceControlRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, siteSourceControl).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// OperationId: WebApps_UpdateSourceControl + /// Description for Updates the source control configuration of an app. + /// JSON representation of a SiteSourceControl object. See example. + /// The cancellation token to use. + /// is null. + public async virtual Task> UpdateAsync(SiteSourceControlData siteSourceControl, CancellationToken cancellationToken = default) + { + if (siteSourceControl == null) + { + throw new ArgumentNullException(nameof(siteSourceControl)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSourceControl.Update"); + scope.Start(); + try + { + var response = await _webAppsRestClient.UpdateSourceControlAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, siteSourceControl, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SiteSourceControl(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web + /// OperationId: WebApps_UpdateSourceControl + /// Description for Updates the source control configuration of an app. + /// JSON representation of a SiteSourceControl object. See example. + /// The cancellation token to use. + /// is null. + public virtual Response Update(SiteSourceControlData siteSourceControl, CancellationToken cancellationToken = default) + { + if (siteSourceControl == null) + { + throw new ArgumentNullException(nameof(siteSourceControl)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteSourceControl.Update"); + scope.Start(); + try + { + var response = _webAppsRestClient.UpdateSourceControl(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, siteSourceControl, cancellationToken); + return Response.FromValue(new SiteSourceControl(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteTriggeredWebJobHistory.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteTriggeredWebJobHistory.cs new file mode 100644 index 000000000000..de80a068fe39 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteTriggeredWebJobHistory.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AppService +{ + /// A Class representing a SiteTriggeredWebJobHistory along with the instance operations that can be performed on it. + public partial class SiteTriggeredWebJobHistory : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + private readonly TriggeredJobHistoryData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteTriggeredWebJobHistory() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteTriggeredWebJobHistory(ArmResource options, TriggeredJobHistoryData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// 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 SiteTriggeredWebJobHistory(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal SiteTriggeredWebJobHistory(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/slots/triggeredwebjobs/history"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// 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 TriggeredJobHistoryData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id} + /// OperationId: WebApps_GetTriggeredWebJobHistorySlot + /// Description for Gets a triggered web job's history by its ID for an app, , or a deployment slot. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredWebJobHistory.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetTriggeredWebJobHistorySlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteTriggeredWebJobHistory(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id} + /// OperationId: WebApps_GetTriggeredWebJobHistorySlot + /// Description for Gets a triggered web job's history by its ID for an app, , or a deployment slot. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredWebJobHistory.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetTriggeredWebJobHistorySlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteTriggeredWebJobHistory(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteTriggeredWebJobHistoryCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteTriggeredWebJobHistoryCollection.cs new file mode 100644 index 000000000000..f6d872636fdf --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteTriggeredWebJobHistoryCollection.cs @@ -0,0 +1,311 @@ +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppService +{ + /// A class representing collection of TriggeredJobHistory and their operations over its parent. + public partial class SiteTriggeredWebJobHistoryCollection : ArmCollection, IEnumerable, IAsyncEnumerable + + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteTriggeredWebJobHistoryCollection() + { + } + + /// Initializes a new instance of SiteTriggeredWebJobHistoryCollection class. + /// The resource representing the parent resource. + internal SiteTriggeredWebJobHistoryCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => SiteTriggeredwebJob.ResourceType; + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_GetTriggeredWebJobHistorySlot + /// Description for Gets a triggered web job's history by its ID for an app, , or a deployment slot. + /// History ID. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string id, CancellationToken cancellationToken = default) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredWebJobHistoryCollection.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetTriggeredWebJobHistorySlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, id, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteTriggeredWebJobHistory(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history/{id} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_GetTriggeredWebJobHistorySlot + /// Description for Gets a triggered web job's history by its ID for an app, , or a deployment slot. + /// History ID. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string id, CancellationToken cancellationToken = default) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredWebJobHistoryCollection.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetTriggeredWebJobHistorySlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, id, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteTriggeredWebJobHistory(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// History ID. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string id, CancellationToken cancellationToken = default) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredWebJobHistoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetTriggeredWebJobHistorySlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, id, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteTriggeredWebJobHistory(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// History ID. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string id, CancellationToken cancellationToken = default) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredWebJobHistoryCollection.GetIfExistsAsync"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetTriggeredWebJobHistorySlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, id, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteTriggeredWebJobHistory(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// History ID. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIfExists(string id, CancellationToken cancellationToken = default) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredWebJobHistoryCollection.CheckIfExists"); + scope.Start(); + try + { + var response = GetIfExists(id, 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. + /// History ID. + /// The cancellation token to use. + /// is null. + public async virtual Task> CheckIfExistsAsync(string id, CancellationToken cancellationToken = default) + { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredWebJobHistoryCollection.CheckIfExistsAsync"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_ListTriggeredWebJobHistorySlot + /// Description for List a triggered web job's history for an app, or a deployment slot. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredWebJobHistoryCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListTriggeredWebJobHistorySlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteTriggeredWebJobHistory(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredWebJobHistoryCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListTriggeredWebJobHistorySlotNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteTriggeredWebJobHistory(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/history + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_ListTriggeredWebJobHistorySlot + /// Description for List a triggered web job's history for an app, or a deployment slot. + /// 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) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredWebJobHistoryCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListTriggeredWebJobHistorySlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteTriggeredWebJobHistory(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredWebJobHistoryCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListTriggeredWebJobHistorySlotNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteTriggeredWebJobHistory(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteTriggeredwebJob.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteTriggeredwebJob.cs new file mode 100644 index 000000000000..f8557fa28808 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteTriggeredwebJob.cs @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AppService +{ + /// A Class representing a SiteTriggeredwebJob along with the instance operations that can be performed on it. + public partial class SiteTriggeredwebJob : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + private readonly TriggeredWebJobData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteTriggeredwebJob() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteTriggeredwebJob(ArmResource options, TriggeredWebJobData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// 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 SiteTriggeredwebJob(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal SiteTriggeredwebJob(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/slots/triggeredwebjobs"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// 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 TriggeredWebJobData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_GetTriggeredWebJobSlot + /// Description for Gets a triggered web job by its ID for an app, or a deployment slot. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJob.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetTriggeredWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteTriggeredwebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_GetTriggeredWebJobSlot + /// Description for Gets a triggered web job by its ID for an app, or a deployment slot. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJob.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetTriggeredWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteTriggeredwebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_DeleteTriggeredWebJobSlot + /// Description for Delete a triggered web job by its ID for an app, or a deployment slot. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJob.Delete"); + scope.Start(); + try + { + var response = await _webAppsRestClient.DeleteTriggeredWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WebAppDeleteTriggeredWebJobSlotOperation(response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_DeleteTriggeredWebJobSlot + /// Description for Delete a triggered web job by its ID for an app, or a deployment slot. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WebAppDeleteTriggeredWebJobSlotOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJob.Delete"); + scope.Start(); + try + { + var response = _webAppsRestClient.DeleteTriggeredWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new WebAppDeleteTriggeredWebJobSlotOperation(response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/run + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_RunTriggeredWebJobSlot + /// Description for Run a triggered web job for an app, or a deployment slot. + /// The cancellation token to use. + public async virtual Task RunTriggeredWebJobSlotAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJob.RunTriggeredWebJobSlot"); + scope.Start(); + try + { + var response = await _webAppsRestClient.RunTriggeredWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName}/run + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// OperationId: WebApps_RunTriggeredWebJobSlot + /// Description for Run a triggered web job for an app, or a deployment slot. + /// The cancellation token to use. + public virtual Response RunTriggeredWebJobSlot(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJob.RunTriggeredWebJobSlot"); + scope.Start(); + try + { + var response = _webAppsRestClient.RunTriggeredWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + #region SiteTriggeredWebJobHistory + + /// Gets a collection of SiteTriggeredWebJobHistories in the SiteTriggeredwebJob. + /// An object representing collection of SiteTriggeredWebJobHistories and their operations over a SiteTriggeredwebJob. + public SiteTriggeredWebJobHistoryCollection GetSiteTriggeredWebJobHistories() + { + return new SiteTriggeredWebJobHistoryCollection(this); + } + #endregion + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteTriggeredwebJobCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteTriggeredwebJobCollection.cs new file mode 100644 index 000000000000..09320e5c6920 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteTriggeredwebJobCollection.cs @@ -0,0 +1,311 @@ +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppService +{ + /// A class representing collection of TriggeredWebJob and their operations over its parent. + public partial class SiteTriggeredwebJobCollection : ArmCollection, IEnumerable, IAsyncEnumerable + + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteTriggeredwebJobCollection() + { + } + + /// Initializes a new instance of SiteTriggeredwebJobCollection class. + /// The resource representing the parent resource. + internal SiteTriggeredwebJobCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => SiteSlot.ResourceType; + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetTriggeredWebJobSlot + /// Description for Gets a triggered web job by its ID for an app, or a deployment slot. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJobCollection.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetTriggeredWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteTriggeredwebJob(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_GetTriggeredWebJobSlot + /// Description for Gets a triggered web job by its ID for an app, or a deployment slot. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJobCollection.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetTriggeredWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteTriggeredwebJob(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetTriggeredWebJobSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteTriggeredwebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJobCollection.GetIfExistsAsync"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetTriggeredWebJobSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteTriggeredwebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIfExists(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJobCollection.CheckIfExists"); + scope.Start(); + try + { + var response = GetIfExists(webJobName, 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. + /// Name of Web Job. + /// The cancellation token to use. + /// is null. + public async virtual Task> CheckIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJobCollection.CheckIfExistsAsync"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_ListTriggeredWebJobsSlot + /// Description for List triggered web jobs for an app, or a deployment slot. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJobCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListTriggeredWebJobsSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteTriggeredwebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJobCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListTriggeredWebJobsSlotNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteTriggeredwebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/triggeredwebjobs + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot} + /// OperationId: WebApps_ListTriggeredWebJobsSlot + /// Description for List triggered web jobs for an app, or a deployment slot. + /// 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) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJobCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListTriggeredWebJobsSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteTriggeredwebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteTriggeredwebJobCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListTriggeredWebJobsSlotNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteTriggeredwebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteWebJob.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteWebJob.cs new file mode 100644 index 000000000000..ad603e7f25b6 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteWebJob.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AppService +{ + /// A Class representing a SiteWebJob along with the instance operations that can be performed on it. + public partial class SiteWebJob : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + private readonly WebJobData _data; + + /// Initializes a new instance of the class for mocking. + protected SiteWebJob() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SiteWebJob(ArmResource options, WebJobData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// 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 SiteWebJob(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal SiteWebJob(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/webjobs"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// 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 WebJobData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName} + /// OperationId: WebApps_GetWebJob + /// Description for Get webjob information for an app, or a deployment slot. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteWebJob.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName} + /// OperationId: WebApps_GetWebJob + /// Description for Get webjob information for an app, or a deployment slot. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SiteWebJob.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteWebJobCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteWebJobCollection.cs new file mode 100644 index 000000000000..790acf48def7 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteWebJobCollection.cs @@ -0,0 +1,311 @@ +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.AppService +{ + /// A class representing collection of WebJob and their operations over its parent. + public partial class SiteWebJobCollection : ArmCollection, IEnumerable, IAsyncEnumerable + + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WebAppsRestOperations _webAppsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SiteWebJobCollection() + { + } + + /// Initializes a new instance of SiteWebJobCollection class. + /// The resource representing the parent resource. + internal SiteWebJobCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => WebSite.ResourceType; + + // Collection level operations. + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_GetWebJob + /// Description for Get webjob information for an app, or a deployment slot. + /// Name of the web job. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteWebJobCollection.Get"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SiteWebJob(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs/{webJobName} + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_GetWebJob + /// Description for Get webjob information for an app, or a deployment slot. + /// Name of the web job. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteWebJobCollection.Get"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new SiteWebJob(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the web job. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteWebJobCollection.GetIfExists"); + scope.Start(); + try + { + var response = _webAppsRestClient.GetWebJob(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the web job. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteWebJobCollection.GetIfExistsAsync"); + scope.Start(); + try + { + var response = await _webAppsRestClient.GetWebJobAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new SiteWebJob(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the web job. + /// The cancellation token to use. + /// is null. + public virtual Response CheckIfExists(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteWebJobCollection.CheckIfExists"); + scope.Start(); + try + { + var response = GetIfExists(webJobName, 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. + /// Name of the web job. + /// The cancellation token to use. + /// is null. + public async virtual Task> CheckIfExistsAsync(string webJobName, CancellationToken cancellationToken = default) + { + if (webJobName == null) + { + throw new ArgumentNullException(nameof(webJobName)); + } + + using var scope = _clientDiagnostics.CreateScope("SiteWebJobCollection.CheckIfExistsAsync"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(webJobName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_ListWebJobs + /// Description for List webjobs for an app, or a deployment slot. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListWebJobs(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = _webAppsRestClient.ListWebJobsNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new SiteWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/webjobs + /// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name} + /// OperationId: WebApps_ListWebJobs + /// Description for List webjobs for an app, or a deployment slot. + /// 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) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListWebJobsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("SiteWebJobCollection.GetAll"); + scope.Start(); + try + { + var response = await _webAppsRestClient.ListWebJobsNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new SiteWebJob(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/User.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/User.cs index 9cd11ded4682..2af641aa7243 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/User.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/User.cs @@ -13,6 +13,7 @@ using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager; +using Azure.ResourceManager.AppService.Models; using Azure.ResourceManager.Core; using Azure.ResourceManager.Resources.Models; @@ -37,6 +38,7 @@ internal User(ArmResource options, UserData resource) : base(options, resource.I { HasData = true; _data = resource; + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _restClient = new WebSiteManagementRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -46,6 +48,7 @@ internal User(ArmResource options, UserData resource) : base(options, resource.I /// The identifier of the resource that is the target of operations. internal User(ArmResource options, ResourceIdentifier id) : base(options, id) { + Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _restClient = new WebSiteManagementRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } @@ -83,6 +86,9 @@ public virtual UserData Data } } + /// Gets the parent resource of this resource. + public ArmResource Parent { get; } + /// RequestPath: /providers/Microsoft.Web/publishingUsers/web /// ContextualPath: /providers/Microsoft.Web/publishingUsers/web /// OperationId: GetPublishingUser @@ -144,5 +150,69 @@ public virtual IEnumerable GetAvailableLocations(CancellationToken can { return ListAvailableLocations(ResourceType, cancellationToken); } + + /// RequestPath: /providers/Microsoft.Web/publishingUsers/web + /// ContextualPath: /providers/Microsoft.Web/publishingUsers/web + /// OperationId: UpdatePublishingUser + /// Description for Updates publishing user. + /// Details of publishing user. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreateOrUpdateAsync(UserData userDetails, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (userDetails == null) + { + throw new ArgumentNullException(nameof(userDetails)); + } + + using var scope = _clientDiagnostics.CreateScope("User.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _restClient.UpdatePublishingUserAsync(userDetails, cancellationToken).ConfigureAwait(false); + var operation = new WebSiteManagementUpdatePublishingUserOperation(this, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// RequestPath: /providers/Microsoft.Web/publishingUsers/web + /// ContextualPath: /providers/Microsoft.Web/publishingUsers/web + /// OperationId: UpdatePublishingUser + /// Description for Updates publishing user. + /// Details of publishing user. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WebSiteManagementUpdatePublishingUserOperation CreateOrUpdate(UserData userDetails, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (userDetails == null) + { + throw new ArgumentNullException(nameof(userDetails)); + } + + using var scope = _clientDiagnostics.CreateScope("User.CreateOrUpdate"); + scope.Start(); + try + { + var response = _restClient.UpdatePublishingUser(userDetails, cancellationToken); + var operation = new WebSiteManagementUpdatePublishingUserOperation(this, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/UserCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/UserCollection.cs deleted file mode 100644 index fc76439fe829..000000000000 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/UserCollection.cs +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.AppService.Models; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Resources; - -namespace Azure.ResourceManager.AppService -{ - /// A class representing collection of User and their operations over its parent. - public partial class UserCollection : ArmCollection - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly WebSiteManagementRestOperations _restClient; - - /// Initializes a new instance of the class for mocking. - protected UserCollection() - { - } - - /// Initializes a new instance of UserCollection class. - /// The resource representing the parent resource. - internal UserCollection(ArmResource parent) : base(parent) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new WebSiteManagementRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => Tenant.ResourceType; - - // Collection level operations. - - /// RequestPath: /providers/Microsoft.Web/publishingUsers/web - /// ContextualPath: / - /// OperationId: UpdatePublishingUser - /// Description for Updates publishing user. - /// Details of publishing user. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WebSiteManagementUpdatePublishingUserOperation CreateOrUpdate(UserData userDetails, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (userDetails == null) - { - throw new ArgumentNullException(nameof(userDetails)); - } - - using var scope = _clientDiagnostics.CreateScope("UserCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _restClient.UpdatePublishingUser(userDetails, cancellationToken); - var operation = new WebSiteManagementUpdatePublishingUserOperation(Parent, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /providers/Microsoft.Web/publishingUsers/web - /// ContextualPath: / - /// OperationId: UpdatePublishingUser - /// Description for Updates publishing user. - /// Details of publishing user. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task CreateOrUpdateAsync(UserData userDetails, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (userDetails == null) - { - throw new ArgumentNullException(nameof(userDetails)); - } - - using var scope = _clientDiagnostics.CreateScope("UserCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _restClient.UpdatePublishingUserAsync(userDetails, cancellationToken).ConfigureAwait(false); - var operation = new WebSiteManagementUpdatePublishingUserOperation(Parent, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /providers/Microsoft.Web/publishingUsers/web - /// ContextualPath: / - /// OperationId: GetPublishingUser - /// Description for Gets publishing user. - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("UserCollection.Get"); - scope.Start(); - try - { - var response = _restClient.GetPublishingUser(cancellationToken); - if (response.Value == null) - throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new User(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// RequestPath: /providers/Microsoft.Web/publishingUsers/web - /// ContextualPath: / - /// OperationId: GetPublishingUser - /// Description for Gets publishing user. - /// The cancellation token to use. - public async virtual Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("UserCollection.Get"); - scope.Start(); - try - { - var response = await _restClient.GetPublishingUserAsync(cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new User(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response GetIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("UserCollection.GetIfExists"); - scope.Start(); - try - { - var response = _restClient.GetPublishingUser(cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new User(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public async virtual Task> GetIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("UserCollection.GetIfExistsAsync"); - scope.Start(); - try - { - var response = await _restClient.GetPublishingUserAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new User(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// The cancellation token to use. - public virtual Response CheckIfExists(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("UserCollection.CheckIfExists"); - scope.Start(); - try - { - var response = GetIfExists(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. - /// The cancellation token to use. - public async virtual Task> CheckIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("UserCollection.CheckIfExistsAsync"); - scope.Start(); - try - { - var response = await GetIfExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - // Builders. - // public ArmBuilder Construct() { } - } -} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSite.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSite.cs index abdf05c2e047..eacb72cd9cd8 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSite.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSite.cs @@ -4389,11 +4389,11 @@ public SiteDomainOwnershipIdentifierCollection GetSiteDomainOwnershipIdentifiers #region SiteExtension - /// Gets a collection of SiteExtensions in the WebSite. - /// An object representing collection of SiteExtensions and their operations over a WebSite. - public SiteExtensionCollection GetSiteExtensions() + /// Gets an object representing a SiteExtension along with the instance operations that can be performed on it in the WebSite. + /// Returns a object. + public SiteExtension GetSiteExtension() { - return new SiteExtensionCollection(this); + return new SiteExtension(this, new ResourceIdentifier(Id.ToString() + "/extensions/MSDeploy")); } #endregion @@ -4449,11 +4449,11 @@ public SiteProcessCollection GetSiteProcesses() #region SiteNetworkConfig - /// Gets a collection of SiteNetworkConfigs in the WebSite. - /// An object representing collection of SiteNetworkConfigs and their operations over a WebSite. - public SiteNetworkConfigCollection GetSiteNetworkConfigs() + /// Gets an object representing a SiteNetworkConfig along with the instance operations that can be performed on it in the WebSite. + /// Returns a object. + public SiteNetworkConfig GetSiteNetworkConfig() { - return new SiteNetworkConfigCollection(this); + return new SiteNetworkConfig(this, new ResourceIdentifier(Id.ToString() + "/networkConfig/virtualNetwork")); } #endregion