diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/IMonitorsOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/IMonitorsOperations.cs new file mode 100644 index 000000000000..813defdf3225 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/IMonitorsOperations.cs @@ -0,0 +1,309 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MonitorsOperations operations. + /// + public partial interface IMonitorsOperations + { + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The + /// operations returns various properties of each SAP monitor. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets properties of a SAP monitor. + /// + /// + /// Gets properties of a SAP monitor for the specified subscription, + /// resource group, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource + /// group, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, Monitor monitorParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource + /// group, and SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Patches the Tags field of a SAP monitor. + /// + /// + /// Patches the Tags field of a SAP monitor for the specified + /// subscription, resource group, and SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The Update SAP workload monitor request body. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string monitorName, UpdateMonitorRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource + /// group, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, Monitor monitorParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource + /// group, and SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The + /// operations returns various properties of each SAP monitor. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/IOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/IOperations.cs new file mode 100644 index 000000000000..08b3f7d4d3c5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/IOperations.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists all the available API operations under this PR + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the available API operations under this PR + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/IPhpWorkloadsOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/IPhpWorkloadsOperations.cs new file mode 100644 index 000000000000..cf484a62a838 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/IPhpWorkloadsOperations.cs @@ -0,0 +1,271 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PhpWorkloadsOperations operations. + /// + public partial interface IPhpWorkloadsOperations + { + /// + /// Lists PHP workload resources for a subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists PHP workload resources in a resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the PHP workload resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or updated PHP workload resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, PhpWorkloadResource phpWorkloadResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update PHP workload resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Workload resource update data + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, PatchResourceRequestBody resourcePatchRequestBody, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete PHP workload resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Whether to delete infra along with workload resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, string deleteInfra = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or updated PHP workload resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, PhpWorkloadResource phpWorkloadResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete PHP workload resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Whether to delete infra along with workload resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, string deleteInfra = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists PHP workload resources for a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists PHP workload resources in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/IProviderInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/IProviderInstancesOperations.cs new file mode 100644 index 000000000000..7a991f9ab13e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/IProviderInstancesOperations.cs @@ -0,0 +1,248 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProviderInstancesOperations operations. + /// + public partial interface IProviderInstancesOperations + { + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets properties of a provider instance. + /// + /// + /// Gets properties of a provider instance for the specified + /// subscription, resource group, SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, + /// resource group, SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Request body representing a provider instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, ProviderInstance providerInstanceParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, + /// resource group, SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, + /// resource group, SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Request body representing a provider instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, ProviderInstance providerInstanceParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, + /// resource group, SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/ISAPApplicationServerInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/ISAPApplicationServerInstancesOperations.cs new file mode 100644 index 000000000000..c24e233a5594 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/ISAPApplicationServerInstancesOperations.cs @@ -0,0 +1,293 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SAPApplicationServerInstancesOperations operations. + /// + public partial interface ISAPApplicationServerInstancesOperations + { + /// + /// Gets the SAP Application Server Instance corresponding to the + /// Virtual Instance for SAP solutions resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Puts the SAP Application Server Instance resource. + /// <br><br>This will be used by service only. PUT by end + /// user will return a Bad Request error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// The SAP Application Server Instance resource request body. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, SAPApplicationServerInstance body = default(SAPApplicationServerInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Puts the SAP Application Server Instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the SAP Application Server Instance resource. + /// <br><br>This operation will be used by service only. + /// Delete by end user will return a Bad Request error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the SAP Application Server Instance resources for a given + /// Virtual Instance for SAP solutions resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Puts the SAP Application Server Instance resource. + /// <br><br>This will be used by service only. PUT by end + /// user will return a Bad Request error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// The SAP Application Server Instance resource request body. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, SAPApplicationServerInstance body = default(SAPApplicationServerInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Puts the SAP Application Server Instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the SAP Application Server Instance resource. + /// <br><br>This operation will be used by service only. + /// Delete by end user will return a Bad Request error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the SAP Application Server Instance resources for a given + /// Virtual Instance for SAP solutions resource. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/ISAPCentralInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/ISAPCentralInstancesOperations.cs new file mode 100644 index 000000000000..566698d670d0 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/ISAPCentralInstancesOperations.cs @@ -0,0 +1,311 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SAPCentralInstancesOperations operations. + /// + public partial interface ISAPCentralInstancesOperations + { + /// + /// Gets the SAP Central Services Instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter + /// for auto generation to work correctly. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. PUT + /// operation on this resource by end user will return a Bad Request + /// error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter + /// for auto generation to work correctly. + /// + /// + /// The SAP Central Services Instance request body. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, SAPCentralServerInstance body = default(SAPCentralServerInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the SAP Central Services Instance resource. + /// <br><br>This can be used to update tags on the + /// resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter + /// for auto generation to work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. Delete + /// operation on this resource by end user will return a Bad Request + /// error. You can delete the parent resource, which is the Virtual + /// Instance for SAP solutions resource, using the delete operation on + /// it. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter + /// for auto generation to work correctly. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the SAP Central Services Instance resource for the given + /// Virtual Instance for SAP solutions resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. PUT + /// operation on this resource by end user will return a Bad Request + /// error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter + /// for auto generation to work correctly. + /// + /// + /// The SAP Central Services Instance request body. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, SAPCentralServerInstance body = default(SAPCentralServerInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the SAP Central Services Instance resource. + /// <br><br>This can be used to update tags on the + /// resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter + /// for auto generation to work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. Delete + /// operation on this resource by end user will return a Bad Request + /// error. You can delete the parent resource, which is the Virtual + /// Instance for SAP solutions resource, using the delete operation on + /// it. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter + /// for auto generation to work correctly. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the SAP Central Services Instance resource for the given + /// Virtual Instance for SAP solutions resource. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/ISAPDatabaseInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/ISAPDatabaseInstancesOperations.cs new file mode 100644 index 000000000000..6d584f5fad6e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/ISAPDatabaseInstancesOperations.cs @@ -0,0 +1,301 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SAPDatabaseInstancesOperations operations. + /// + public partial interface ISAPDatabaseInstancesOperations + { + /// + /// Gets the SAP Database Instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto + /// generation to work correctly. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates the Database resource corresponding to the Virtual Instance + /// for SAP solutions resource. <br><br>This will be used + /// by service only. PUT by end user will return a Bad Request error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto + /// generation to work correctly. + /// + /// + /// Request body of Database resource of a SAP system. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, SAPDatabaseInstance body = default(SAPDatabaseInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the Database resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto + /// generation to work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the Database resource corresponding to a Virtual Instance + /// for SAP solutions resource. <br><br>This will be used + /// by service only. Delete by end user will return a Bad Request + /// error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto + /// generation to work correctly. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the Database resources associated with a Virtual Instance for + /// SAP solutions resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates the Database resource corresponding to the Virtual Instance + /// for SAP solutions resource. <br><br>This will be used + /// by service only. PUT by end user will return a Bad Request error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto + /// generation to work correctly. + /// + /// + /// Request body of Database resource of a SAP system. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, SAPDatabaseInstance body = default(SAPDatabaseInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the Database resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto + /// generation to work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the Database resource corresponding to a Virtual Instance + /// for SAP solutions resource. <br><br>This will be used + /// by service only. Delete by end user will return a Bad Request + /// error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto + /// generation to work correctly. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the Database resources associated with a Virtual Instance for + /// SAP solutions resource. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/ISAPVirtualInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/ISAPVirtualInstancesOperations.cs new file mode 100644 index 000000000000..d22a48e10a24 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/ISAPVirtualInstancesOperations.cs @@ -0,0 +1,390 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SAPVirtualInstancesOperations operations. + /// + public partial interface ISAPVirtualInstancesOperations + { + /// + /// Creates a Virtual Instance for SAP solutions (VIS) resource + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Virtual Instance for SAP solutions resource request body. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, SAPVirtualInstance body = default(SAPVirtualInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a Virtual Instance for SAP solutions resource + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a Virtual Instance for SAP solutions resource + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Request body to update a Virtual Instance for SAP solutions + /// resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, UpdateSAPVirtualInstanceRequest body = default(UpdateSAPVirtualInstanceRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Virtual Instance for SAP solutions resource and its child + /// resources, that is the associated Central Services Instance, + /// Application Server Instances and Database Instance. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all Virtual Instances for SAP solutions resources in a + /// Resource Group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all Virtual Instances for SAP solutions resources in a + /// Subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts the SAP application, that is the Central Services instance + /// and Application server instances. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> StartWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stops the SAP Application, that is the Application server instances + /// and Central Services instance. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// A boolean to specify if the SAP system should be hard-stopped. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> StopWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, bool? hardStop = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a Virtual Instance for SAP solutions (VIS) resource + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Virtual Instance for SAP solutions resource request body. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, SAPVirtualInstance body = default(SAPVirtualInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Virtual Instance for SAP solutions resource and its child + /// resources, that is the associated Central Services Instance, + /// Application Server Instances and Database Instance. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts the SAP application, that is the Central Services instance + /// and Application server instances. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginStartWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stops the SAP Application, that is the Application server instances + /// and Central Services instance. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// A boolean to specify if the SAP system should be hard-stopped. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginStopWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, bool? hardStop = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all Virtual Instances for SAP solutions resources in a + /// Resource Group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all Virtual Instances for SAP solutions resources in a + /// Subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/ISkusOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/ISkusOperations.cs new file mode 100644 index 000000000000..79d7ee4e34f8 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/ISkusOperations.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SkusOperations operations. + /// + public partial interface ISkusOperations + { + /// + /// Lists all the available SKUs under this PR + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the available SKUs under this PR + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/IWordpressInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/IWordpressInstancesOperations.cs new file mode 100644 index 000000000000..7c27678ebf85 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/IWordpressInstancesOperations.cs @@ -0,0 +1,177 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WordpressInstancesOperations operations. + /// + public partial interface IWordpressInstancesOperations + { + /// + /// Lists WordPress instance resources under a phpWorkload resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the WordPress instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or updated WordPress instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, WordpressInstanceResource wordpressInstanceResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete WordPress instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or updated WordPress instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, WordpressInstanceResource wordpressInstanceResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists WordPress instance resources under a phpWorkload resource. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/IWorkloadsClient.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/IWorkloadsClient.cs new file mode 100644 index 000000000000..6ea24c26b900 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/IWorkloadsClient.cs @@ -0,0 +1,197 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// + public partial interface IWorkloadsClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// The API version to use for this operation. + /// + string ApiVersion { get; } + + /// + /// The ID of the target subscription. + /// + string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IPhpWorkloadsOperations. + /// + IPhpWorkloadsOperations PhpWorkloads { get; } + + /// + /// Gets the IWordpressInstancesOperations. + /// + IWordpressInstancesOperations WordpressInstances { get; } + + /// + /// Gets the ISAPVirtualInstancesOperations. + /// + ISAPVirtualInstancesOperations SAPVirtualInstances { get; } + + /// + /// Gets the ISAPCentralInstancesOperations. + /// + ISAPCentralInstancesOperations SAPCentralInstances { get; } + + /// + /// Gets the ISAPDatabaseInstancesOperations. + /// + ISAPDatabaseInstancesOperations SAPDatabaseInstances { get; } + + /// + /// Gets the ISAPApplicationServerInstancesOperations. + /// + ISAPApplicationServerInstancesOperations SAPApplicationServerInstances { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IMonitorsOperations. + /// + IMonitorsOperations Monitors { get; } + + /// + /// Gets the IProviderInstancesOperations. + /// + IProviderInstancesOperations ProviderInstances { get; } + + /// + /// Gets the ISkusOperations. + /// + ISkusOperations Skus { get; } + + /// + /// Get SAP sizing recommendations by providing input SAPS for + /// application tier and memory required for database tier + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Sizing Recommendation Request body + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> SAPSizingRecommendationsWithHttpMessagesAsync(string location, SAPSizingRecommendationRequest sAPSizingRecommendation = default(SAPSizingRecommendationRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Get a list of SAP supported SKUs for ASCS, Application and Database + /// tier. + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Supported SKU Request body + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> SAPSupportedSkuMethodWithHttpMessagesAsync(string location, SAPSupportedSkusRequest sAPSupportedSku = default(SAPSupportedSkusRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Get the SAP Disk Configuration Layout prod/non-prod SAP System. + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Disk Configurations Request body + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> SAPDiskConfigurationsWithHttpMessagesAsync(string location, SAPDiskConfigurationsRequest sAPDiskConfigurations = default(SAPDiskConfigurationsRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Get the recommended SAP Availability Zone Pair Details for your + /// region. + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Availability Zone Details Request body + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> SAPAvailabilityZoneDetailsWithHttpMessagesAsync(string location, SAPAvailabilityZoneDetailsRequest sAPAvailabilityZoneDetails = default(SAPAvailabilityZoneDetailsRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ActionType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ActionType.cs new file mode 100644 index 000000000000..40087748b4c4 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ActionType.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for ActionType. + /// + public static class ActionType + { + public const string Internal = "Internal"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ApplicationProvisioningState.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ApplicationProvisioningState.cs new file mode 100644 index 000000000000..e1549fa0567c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ApplicationProvisioningState.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for ApplicationProvisioningState. + /// + public static class ApplicationProvisioningState + { + public const string NotSpecified = "NotSpecified"; + public const string Accepted = "Accepted"; + public const string Created = "Created"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + public const string Installing = "Installing"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ApplicationServerConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ApplicationServerConfiguration.cs new file mode 100644 index 000000000000..d1326cb0f5ec --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ApplicationServerConfiguration.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the application server configuration. + /// + public partial class ApplicationServerConfiguration + { + /// + /// Initializes a new instance of the ApplicationServerConfiguration + /// class. + /// + public ApplicationServerConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationServerConfiguration + /// class. + /// + /// The subnet id. + /// Gets or sets the virtual + /// machine configuration. + /// The number of app server + /// instances. + public ApplicationServerConfiguration(string subnetId, VirtualMachineConfiguration virtualMachineConfiguration, long instanceCount) + { + SubnetId = subnetId; + VirtualMachineConfiguration = virtualMachineConfiguration; + InstanceCount = instanceCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the subnet id. + /// + [JsonProperty(PropertyName = "subnetId")] + public string SubnetId { get; set; } + + /// + /// Gets or sets the virtual machine configuration. + /// + [JsonProperty(PropertyName = "virtualMachineConfiguration")] + public VirtualMachineConfiguration VirtualMachineConfiguration { get; set; } + + /// + /// Gets or sets the number of app server instances. + /// + [JsonProperty(PropertyName = "instanceCount")] + public long InstanceCount { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SubnetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SubnetId"); + } + if (VirtualMachineConfiguration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VirtualMachineConfiguration"); + } + if (VirtualMachineConfiguration != null) + { + VirtualMachineConfiguration.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/AzureEntityResource.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/AzureEntityResource.cs new file mode 100644 index 000000000000..cbcd0a2e27f5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/AzureEntityResource.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Entity Resource + /// + /// + /// The resource model definition for an Azure Resource Manager resource + /// with an etag. + /// + public partial class AzureEntityResource : Resource + { + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + public AzureEntityResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource Etag. + public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData) + { + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Etag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/AzureFrontDoorEnabled.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/AzureFrontDoorEnabled.cs new file mode 100644 index 000000000000..5c8ad102a7fb --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/AzureFrontDoorEnabled.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for AzureFrontDoorEnabled. + /// + public static class AzureFrontDoorEnabled + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/BackupProfile.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/BackupProfile.cs new file mode 100644 index 000000000000..7f65971cebe6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/BackupProfile.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Backup profile + /// + public partial class BackupProfile + { + /// + /// Initializes a new instance of the BackupProfile class. + /// + public BackupProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BackupProfile class. + /// + /// Whether to enable Azure backup for the + /// workload. Possible values include: 'Enabled', 'Disabled' + /// Backup vault resource Id + public BackupProfile(string backupEnabled, string vaultResourceId = default(string)) + { + BackupEnabled = backupEnabled; + VaultResourceId = vaultResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable Azure backup for the workload. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "backupEnabled")] + public string BackupEnabled { get; set; } + + /// + /// Gets backup vault resource Id + /// + [JsonProperty(PropertyName = "vaultResourceId")] + public string VaultResourceId { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (BackupEnabled == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BackupEnabled"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/CacheProfile.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/CacheProfile.cs new file mode 100644 index 000000000000..9a6bff01c0d7 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/CacheProfile.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Cache profile + /// + public partial class CacheProfile + { + /// + /// Initializes a new instance of the CacheProfile class. + /// + public CacheProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CacheProfile class. + /// + /// Cache SKU name + /// Cache family. Possible values include: 'C', + /// 'P' + /// Cache capacity + /// Cache name + /// Cache resource Id + public CacheProfile(string skuName, string family, long capacity, string name = default(string), string cacheResourceId = default(string)) + { + Name = name; + SkuName = skuName; + Family = family; + Capacity = capacity; + CacheResourceId = cacheResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets cache name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets cache SKU name + /// + [JsonProperty(PropertyName = "skuName")] + public string SkuName { get; set; } + + /// + /// Gets or sets cache family. Possible values include: 'C', 'P' + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; set; } + + /// + /// Gets or sets cache capacity + /// + [JsonProperty(PropertyName = "capacity")] + public long Capacity { get; set; } + + /// + /// Gets cache resource Id + /// + [JsonProperty(PropertyName = "cacheResourceId")] + public string CacheResourceId { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SkuName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SkuName"); + } + if (Family == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Family"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/CentralServerConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/CentralServerConfiguration.cs new file mode 100644 index 000000000000..305315265b07 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/CentralServerConfiguration.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the central server configuration. + /// + public partial class CentralServerConfiguration + { + /// + /// Initializes a new instance of the CentralServerConfiguration class. + /// + public CentralServerConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CentralServerConfiguration class. + /// + /// The subnet id. + /// Gets or sets the virtual + /// machine configuration. + /// The number of central server + /// VMs. + public CentralServerConfiguration(string subnetId, VirtualMachineConfiguration virtualMachineConfiguration, long instanceCount) + { + SubnetId = subnetId; + VirtualMachineConfiguration = virtualMachineConfiguration; + InstanceCount = instanceCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the subnet id. + /// + [JsonProperty(PropertyName = "subnetId")] + public string SubnetId { get; set; } + + /// + /// Gets or sets the virtual machine configuration. + /// + [JsonProperty(PropertyName = "virtualMachineConfiguration")] + public VirtualMachineConfiguration VirtualMachineConfiguration { get; set; } + + /// + /// Gets or sets the number of central server VMs. + /// + [JsonProperty(PropertyName = "instanceCount")] + public long InstanceCount { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SubnetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SubnetId"); + } + if (VirtualMachineConfiguration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VirtualMachineConfiguration"); + } + if (VirtualMachineConfiguration != null) + { + VirtualMachineConfiguration.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/CentralServerVirtualMachineType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/CentralServerVirtualMachineType.cs new file mode 100644 index 000000000000..298af66252bd --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/CentralServerVirtualMachineType.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for CentralServerVirtualMachineType. + /// + public static class CentralServerVirtualMachineType + { + public const string Primary = "Primary"; + public const string Secondary = "Secondary"; + public const string Unknown = "Unknown"; + public const string ASCS = "ASCS"; + public const string ERSInactive = "ERSInactive"; + public const string ERS = "ERS"; + public const string Standby = "Standby"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/CentralServerVmDetails.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/CentralServerVmDetails.cs new file mode 100644 index 000000000000..b2804e0520c0 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/CentralServerVmDetails.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SAP Central Services Instance VM details. + /// + public partial class CentralServerVmDetails + { + /// + /// Initializes a new instance of the CentralServerVmDetails class. + /// + public CentralServerVmDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CentralServerVmDetails class. + /// + /// Possible values include: 'Primary', 'Secondary', + /// 'Unknown', 'ASCS', 'ERSInactive', 'ERS', 'Standby' + public CentralServerVmDetails(string type = default(string), string virtualMachineId = default(string)) + { + Type = type; + VirtualMachineId = virtualMachineId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets possible values include: 'Primary', 'Secondary', 'Unknown', + /// 'ASCS', 'ERSInactive', 'ERS', 'Standby' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "virtualMachineId")] + public string VirtualMachineId { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/CreatedByType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/CreatedByType.cs new file mode 100644 index 000000000000..b0f29fb10fdb --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DB2ProviderInstanceProperties.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DB2ProviderInstanceProperties.cs new file mode 100644 index 000000000000..b82d31902ff6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DB2ProviderInstanceProperties.cs @@ -0,0 +1,108 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the DB2 provider properties. + /// + [Newtonsoft.Json.JsonObject("Db2")] + public partial class DB2ProviderInstanceProperties : ProviderSpecificProperties + { + /// + /// Initializes a new instance of the DB2ProviderInstanceProperties + /// class. + /// + public DB2ProviderInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DB2ProviderInstanceProperties + /// class. + /// + /// Gets or sets the target virtual machine + /// name. + /// Gets or sets the db2 database name. + /// Gets or sets the db2 database sql + /// port. + /// Gets or sets the db2 database user + /// name. + /// Gets or sets the db2 database + /// password. + /// Gets or sets the key vault URI to + /// secret with the database password. + /// Gets or sets the SAP System Identifier + public DB2ProviderInstanceProperties(string hostname = default(string), string dbName = default(string), string dbPort = default(string), string dbUsername = default(string), string dbPassword = default(string), string dbPasswordUri = default(string), string sapSid = default(string)) + { + Hostname = hostname; + DbName = dbName; + DbPort = dbPort; + DbUsername = dbUsername; + DbPassword = dbPassword; + DbPasswordUri = dbPasswordUri; + SapSid = sapSid; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the target virtual machine name. + /// + [JsonProperty(PropertyName = "hostname")] + public string Hostname { get; set; } + + /// + /// Gets or sets the db2 database name. + /// + [JsonProperty(PropertyName = "dbName")] + public string DbName { get; set; } + + /// + /// Gets or sets the db2 database sql port. + /// + [JsonProperty(PropertyName = "dbPort")] + public string DbPort { get; set; } + + /// + /// Gets or sets the db2 database user name. + /// + [JsonProperty(PropertyName = "dbUsername")] + public string DbUsername { get; set; } + + /// + /// Gets or sets the db2 database password. + /// + [JsonProperty(PropertyName = "dbPassword")] + public string DbPassword { get; set; } + + /// + /// Gets or sets the key vault URI to secret with the database + /// password. + /// + [JsonProperty(PropertyName = "dbPasswordUri")] + public string DbPasswordUri { get; set; } + + /// + /// Gets or sets the SAP System Identifier + /// + [JsonProperty(PropertyName = "sapSid")] + public string SapSid { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DatabaseConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DatabaseConfiguration.cs new file mode 100644 index 000000000000..8701b20c17ec --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DatabaseConfiguration.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the database configuration. + /// + public partial class DatabaseConfiguration + { + /// + /// Initializes a new instance of the DatabaseConfiguration class. + /// + public DatabaseConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseConfiguration class. + /// + /// The subnet id. + /// Gets or sets the virtual + /// machine configuration. + /// The number of database VMs. + /// The database type. Possible values + /// include: 'HANA', 'DB2' + public DatabaseConfiguration(string subnetId, VirtualMachineConfiguration virtualMachineConfiguration, long instanceCount, string databaseType = default(string)) + { + DatabaseType = databaseType; + SubnetId = subnetId; + VirtualMachineConfiguration = virtualMachineConfiguration; + InstanceCount = instanceCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the database type. Possible values include: 'HANA', + /// 'DB2' + /// + [JsonProperty(PropertyName = "databaseType")] + public string DatabaseType { get; set; } + + /// + /// Gets or sets the subnet id. + /// + [JsonProperty(PropertyName = "subnetId")] + public string SubnetId { get; set; } + + /// + /// Gets or sets the virtual machine configuration. + /// + [JsonProperty(PropertyName = "virtualMachineConfiguration")] + public VirtualMachineConfiguration VirtualMachineConfiguration { get; set; } + + /// + /// Gets or sets the number of database VMs. + /// + [JsonProperty(PropertyName = "instanceCount")] + public long InstanceCount { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SubnetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SubnetId"); + } + if (VirtualMachineConfiguration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VirtualMachineConfiguration"); + } + if (VirtualMachineConfiguration != null) + { + VirtualMachineConfiguration.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DatabaseProfile.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DatabaseProfile.cs new file mode 100644 index 000000000000..41a6b38c6b32 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DatabaseProfile.cs @@ -0,0 +1,172 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Workload database profile + /// + public partial class DatabaseProfile + { + /// + /// Initializes a new instance of the DatabaseProfile class. + /// + public DatabaseProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseProfile class. + /// + /// The name of the server SKU, e.g. + /// Standard_D32s_v4 + /// Tier of the server SKU. Possible values include: + /// 'Burstable', 'GeneralPurpose', 'MemoryOptimized' + /// Database server name + /// Database version + /// Whether to enable HA for the server. + /// Possible values include: 'Enabled', 'Disabled' + /// SKU name for database storage + /// Database storage size in GB + /// Storage IOPS for the server + /// Backup retention days for the + /// server + /// Whether to enable SSL + /// enforcement on the database. Possible values include: 'Enabled', + /// 'Disabled' + /// Azure Database Server resource + /// Id + public DatabaseProfile(string sku, DatabaseTier tier, string serverName = default(string), string version = default(string), string haEnabled = default(string), string storageSku = default(string), long? storageInGB = default(long?), long? storageIops = default(long?), int? backupRetentionDays = default(int?), string sslEnforcementEnabled = default(string), string serverResourceId = default(string)) + { + ServerName = serverName; + Version = version; + Sku = sku; + Tier = tier; + HaEnabled = haEnabled; + StorageSku = storageSku; + StorageInGB = storageInGB; + StorageIops = storageIops; + BackupRetentionDays = backupRetentionDays; + SslEnforcementEnabled = sslEnforcementEnabled; + ServerResourceId = serverResourceId; + CustomInit(); + } + /// + /// Static constructor for DatabaseProfile class. + /// + static DatabaseProfile() + { + Type = "MySql"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets database server name + /// + [JsonProperty(PropertyName = "serverName")] + public string ServerName { get; set; } + + /// + /// Gets or sets database version + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Gets or sets the name of the server SKU, e.g. Standard_D32s_v4 + /// + [JsonProperty(PropertyName = "sku")] + public string Sku { get; set; } + + /// + /// Gets or sets tier of the server SKU. Possible values include: + /// 'Burstable', 'GeneralPurpose', 'MemoryOptimized' + /// + [JsonProperty(PropertyName = "tier")] + public DatabaseTier Tier { get; set; } + + /// + /// Gets or sets whether to enable HA for the server. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "haEnabled")] + public string HaEnabled { get; set; } + + /// + /// Gets or sets SKU name for database storage + /// + [JsonProperty(PropertyName = "storageSku")] + public string StorageSku { get; set; } + + /// + /// Gets or sets database storage size in GB + /// + [JsonProperty(PropertyName = "storageInGB")] + public long? StorageInGB { get; set; } + + /// + /// Gets or sets storage IOPS for the server + /// + [JsonProperty(PropertyName = "storageIops")] + public long? StorageIops { get; set; } + + /// + /// Gets or sets backup retention days for the server + /// + [JsonProperty(PropertyName = "backupRetentionDays")] + public int? BackupRetentionDays { get; set; } + + /// + /// Gets or sets whether to enable SSL enforcement on the database. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "sslEnforcementEnabled")] + public string SslEnforcementEnabled { get; set; } + + /// + /// Gets azure Database Server resource Id + /// + [JsonProperty(PropertyName = "serverResourceId")] + public string ServerResourceId { get; private set; } + + /// + /// Database type + /// + [JsonProperty(PropertyName = "type")] + public static string Type { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Sku == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); + } + if (StorageInGB < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "StorageInGB", 1); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DatabaseTier.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DatabaseTier.cs new file mode 100644 index 000000000000..9659839ce316 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DatabaseTier.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for DatabaseTier. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DatabaseTier + { + [EnumMember(Value = "Burstable")] + Burstable, + [EnumMember(Value = "GeneralPurpose")] + GeneralPurpose, + [EnumMember(Value = "MemoryOptimized")] + MemoryOptimized + } + internal static class DatabaseTierEnumExtension + { + internal static string ToSerializedValue(this DatabaseTier? value) + { + return value == null ? null : ((DatabaseTier)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DatabaseTier value) + { + switch( value ) + { + case DatabaseTier.Burstable: + return "Burstable"; + case DatabaseTier.GeneralPurpose: + return "GeneralPurpose"; + case DatabaseTier.MemoryOptimized: + return "MemoryOptimized"; + } + return null; + } + + internal static DatabaseTier? ParseDatabaseTier(this string value) + { + switch( value ) + { + case "Burstable": + return DatabaseTier.Burstable; + case "GeneralPurpose": + return DatabaseTier.GeneralPurpose; + case "MemoryOptimized": + return DatabaseTier.MemoryOptimized; + } + return null; + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DatabaseVmDetails.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DatabaseVmDetails.cs new file mode 100644 index 000000000000..5e60c2284fa9 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DatabaseVmDetails.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Database VM details. + /// + public partial class DatabaseVmDetails + { + /// + /// Initializes a new instance of the DatabaseVmDetails class. + /// + public DatabaseVmDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseVmDetails class. + /// + /// Possible values include: 'Starting', + /// 'Running', 'Stopping', 'Offline', 'PartiallyRunning', + /// 'Unavailable' + public DatabaseVmDetails(string virtualMachineId = default(string), string status = default(string)) + { + VirtualMachineId = virtualMachineId; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "virtualMachineId")] + public string VirtualMachineId { get; private set; } + + /// + /// Gets possible values include: 'Starting', 'Running', 'Stopping', + /// 'Offline', 'PartiallyRunning', 'Unavailable' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DeployerVmPackages.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DeployerVmPackages.cs new file mode 100644 index 000000000000..c307af9ac40f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DeployerVmPackages.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the url and storage account ID where deployer VM packages are + /// uploaded + /// + public partial class DeployerVmPackages + { + /// + /// Initializes a new instance of the DeployerVmPackages class. + /// + public DeployerVmPackages() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeployerVmPackages class. + /// + /// The URL to the deployer VM packages file. + /// The deployer VM packages storage + /// account id + public DeployerVmPackages(string url = default(string), string storageAccountId = default(string)) + { + Url = url; + StorageAccountId = storageAccountId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL to the deployer VM packages file. + /// + [JsonProperty(PropertyName = "url")] + public string Url { get; set; } + + /// + /// Gets or sets the deployer VM packages storage account id + /// + [JsonProperty(PropertyName = "storageAccountId")] + public string StorageAccountId { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DeploymentConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DeploymentConfiguration.cs new file mode 100644 index 000000000000..f7670765c7be --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DeploymentConfiguration.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Deployment Configuration. + /// + [Newtonsoft.Json.JsonObject("Deployment")] + public partial class DeploymentConfiguration : SAPConfiguration + { + /// + /// Initializes a new instance of the DeploymentConfiguration class. + /// + public DeploymentConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentConfiguration class. + /// + /// The geo-location where the SAP system is + /// to be created. + /// The infrastructure + /// configuration. + /// The software + /// configuration. + public DeploymentConfiguration(string appLocation = default(string), InfrastructureConfiguration infrastructureConfiguration = default(InfrastructureConfiguration), SoftwareConfiguration softwareConfiguration = default(SoftwareConfiguration)) + { + AppLocation = appLocation; + InfrastructureConfiguration = infrastructureConfiguration; + SoftwareConfiguration = softwareConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the geo-location where the SAP system is to be + /// created. + /// + [JsonProperty(PropertyName = "appLocation")] + public string AppLocation { get; set; } + + /// + /// Gets or sets the infrastructure configuration. + /// + [JsonProperty(PropertyName = "infrastructureConfiguration")] + public InfrastructureConfiguration InfrastructureConfiguration { get; set; } + + /// + /// Gets or sets the software configuration. + /// + [JsonProperty(PropertyName = "softwareConfiguration")] + public SoftwareConfiguration SoftwareConfiguration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (InfrastructureConfiguration != null) + { + InfrastructureConfiguration.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DeploymentWithOSConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DeploymentWithOSConfiguration.cs new file mode 100644 index 000000000000..820b5c9f3a6f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DeploymentWithOSConfiguration.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Deployment along with OS Configuration. + /// + [Newtonsoft.Json.JsonObject("DeploymentWithOSConfig")] + public partial class DeploymentWithOSConfiguration : SAPConfiguration + { + /// + /// Initializes a new instance of the DeploymentWithOSConfiguration + /// class. + /// + public DeploymentWithOSConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentWithOSConfiguration + /// class. + /// + /// The geo-location where the SAP system is + /// to be created. + /// The infrastructure + /// configuration. + /// The software + /// configuration. + /// The OS and SAP + /// configuration. + public DeploymentWithOSConfiguration(string appLocation = default(string), InfrastructureConfiguration infrastructureConfiguration = default(InfrastructureConfiguration), SoftwareConfiguration softwareConfiguration = default(SoftwareConfiguration), OsSapConfiguration osSapConfiguration = default(OsSapConfiguration)) + { + AppLocation = appLocation; + InfrastructureConfiguration = infrastructureConfiguration; + SoftwareConfiguration = softwareConfiguration; + OsSapConfiguration = osSapConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the geo-location where the SAP system is to be + /// created. + /// + [JsonProperty(PropertyName = "appLocation")] + public string AppLocation { get; set; } + + /// + /// Gets or sets the infrastructure configuration. + /// + [JsonProperty(PropertyName = "infrastructureConfiguration")] + public InfrastructureConfiguration InfrastructureConfiguration { get; set; } + + /// + /// Gets or sets the software configuration. + /// + [JsonProperty(PropertyName = "softwareConfiguration")] + public SoftwareConfiguration SoftwareConfiguration { get; set; } + + /// + /// Gets or sets the OS and SAP configuration. + /// + [JsonProperty(PropertyName = "osSapConfiguration")] + public OsSapConfiguration OsSapConfiguration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (InfrastructureConfiguration != null) + { + InfrastructureConfiguration.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DiscoveryConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DiscoveryConfiguration.cs new file mode 100644 index 000000000000..c4eb67538056 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DiscoveryConfiguration.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Discovery Details. + /// + [Newtonsoft.Json.JsonObject("Discovery")] + public partial class DiscoveryConfiguration : SAPConfiguration + { + /// + /// Initializes a new instance of the DiscoveryConfiguration class. + /// + public DiscoveryConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiscoveryConfiguration class. + /// + /// The virtual machine ID of the + /// Central Server. + /// The geo-location where the SAP system + /// exists. + public DiscoveryConfiguration(string centralServerVmId = default(string), string appLocation = default(string)) + { + CentralServerVmId = centralServerVmId; + AppLocation = appLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine ID of the Central Server. + /// + [JsonProperty(PropertyName = "centralServerVmId")] + public string CentralServerVmId { get; set; } + + /// + /// Gets the geo-location where the SAP system exists. + /// + [JsonProperty(PropertyName = "appLocation")] + public string AppLocation { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DiskInfo.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DiskInfo.cs new file mode 100644 index 000000000000..7d6488b6db36 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DiskInfo.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Disk resource creation details + /// + public partial class DiskInfo + { + /// + /// Initializes a new instance of the DiskInfo class. + /// + public DiskInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskInfo class. + /// + /// Storage type. Possible values include: + /// 'Premium_LRS', 'Standard_LRS', 'StandardSSD_LRS' + /// Disk size in GB + public DiskInfo(DiskStorageType storageType, long? sizeInGB = default(long?)) + { + StorageType = storageType; + SizeInGB = sizeInGB; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets storage type. Possible values include: 'Premium_LRS', + /// 'Standard_LRS', 'StandardSSD_LRS' + /// + [JsonProperty(PropertyName = "storageType")] + public DiskStorageType StorageType { get; set; } + + /// + /// Gets or sets disk size in GB + /// + [JsonProperty(PropertyName = "sizeInGB")] + public long? SizeInGB { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DiskStorageType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DiskStorageType.cs new file mode 100644 index 000000000000..5a7472c9a59b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/DiskStorageType.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for DiskStorageType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DiskStorageType + { + [EnumMember(Value = "Premium_LRS")] + PremiumLRS, + [EnumMember(Value = "Standard_LRS")] + StandardLRS, + [EnumMember(Value = "StandardSSD_LRS")] + StandardSSDLRS + } + internal static class DiskStorageTypeEnumExtension + { + internal static string ToSerializedValue(this DiskStorageType? value) + { + return value == null ? null : ((DiskStorageType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DiskStorageType value) + { + switch( value ) + { + case DiskStorageType.PremiumLRS: + return "Premium_LRS"; + case DiskStorageType.StandardLRS: + return "Standard_LRS"; + case DiskStorageType.StandardSSDLRS: + return "StandardSSD_LRS"; + } + return null; + } + + internal static DiskStorageType? ParseDiskStorageType(this string value) + { + switch( value ) + { + case "Premium_LRS": + return DiskStorageType.PremiumLRS; + case "Standard_LRS": + return DiskStorageType.StandardLRS; + case "StandardSSD_LRS": + return DiskStorageType.StandardSSDLRS; + } + return null; + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/EnableBackup.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/EnableBackup.cs new file mode 100644 index 000000000000..236f9156c63d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/EnableBackup.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for EnableBackup. + /// + public static class EnableBackup + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/EnableSslEnforcement.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/EnableSslEnforcement.cs new file mode 100644 index 000000000000..a2d350bfc1cf --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/EnableSslEnforcement.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for EnableSslEnforcement. + /// + public static class EnableSslEnforcement + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/EnqueueReplicationServerProperties.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/EnqueueReplicationServerProperties.cs new file mode 100644 index 000000000000..cd807c0a3495 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/EnqueueReplicationServerProperties.cs @@ -0,0 +1,105 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the SAP Enqueue Replication Server (ERS) properties. + /// + public partial class EnqueueReplicationServerProperties + { + /// + /// Initializes a new instance of the + /// EnqueueReplicationServerProperties class. + /// + public EnqueueReplicationServerProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// EnqueueReplicationServerProperties class. + /// + /// Possible values include: + /// 'EnqueueReplicator1', 'EnqueueReplicator2' + /// ERS Instance Number. + /// ERS SAP Hostname. + /// ERS SAP Kernel Version. + /// ERS SAP Kernel Patch level. + /// ERS SAP IP Address. + /// Possible values include: 'Unknown', 'Healthy', + /// 'Unhealthy', 'Degraded' + public EnqueueReplicationServerProperties(string ersVersion = default(string), string instanceNo = default(string), string hostname = default(string), string kernelVersion = default(string), string kernelPatch = default(string), string ipAddress = default(string), string health = default(string)) + { + ErsVersion = ersVersion; + InstanceNo = instanceNo; + Hostname = hostname; + KernelVersion = kernelVersion; + KernelPatch = kernelPatch; + IpAddress = ipAddress; + Health = health; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets possible values include: 'EnqueueReplicator1', + /// 'EnqueueReplicator2' + /// + [JsonProperty(PropertyName = "ersVersion")] + public string ErsVersion { get; private set; } + + /// + /// Gets ERS Instance Number. + /// + [JsonProperty(PropertyName = "instanceNo")] + public string InstanceNo { get; private set; } + + /// + /// Gets ERS SAP Hostname. + /// + [JsonProperty(PropertyName = "hostname")] + public string Hostname { get; private set; } + + /// + /// Gets ERS SAP Kernel Version. + /// + [JsonProperty(PropertyName = "kernelVersion")] + public string KernelVersion { get; private set; } + + /// + /// Gets ERS SAP Kernel Patch level. + /// + [JsonProperty(PropertyName = "kernelPatch")] + public string KernelPatch { get; private set; } + + /// + /// Gets ERS SAP IP Address. + /// + [JsonProperty(PropertyName = "ipAddress")] + public string IpAddress { get; private set; } + + /// + /// Gets possible values include: 'Unknown', 'Healthy', 'Unhealthy', + /// 'Degraded' + /// + [JsonProperty(PropertyName = "health")] + public string Health { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/EnqueueReplicationServerType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/EnqueueReplicationServerType.cs new file mode 100644 index 000000000000..8fe1da94ee08 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/EnqueueReplicationServerType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for EnqueueReplicationServerType. + /// + public static class EnqueueReplicationServerType + { + public const string EnqueueReplicator1 = "EnqueueReplicator1"; + public const string EnqueueReplicator2 = "EnqueueReplicator2"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/EnqueueServerProperties.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/EnqueueServerProperties.cs new file mode 100644 index 000000000000..70e57a9aced6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/EnqueueServerProperties.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the SAP Enqueue Server properties. + /// + public partial class EnqueueServerProperties + { + /// + /// Initializes a new instance of the EnqueueServerProperties class. + /// + public EnqueueServerProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnqueueServerProperties class. + /// + /// Enqueue Server SAP Hostname. + /// Enqueue Server SAP IP Address. + /// Enqueue Server Port. + /// Possible values include: 'Unknown', 'Healthy', + /// 'Unhealthy', 'Degraded' + public EnqueueServerProperties(string hostname = default(string), string ipAddress = default(string), long? port = default(long?), string health = default(string)) + { + Hostname = hostname; + IpAddress = ipAddress; + Port = port; + Health = health; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets enqueue Server SAP Hostname. + /// + [JsonProperty(PropertyName = "hostname")] + public string Hostname { get; private set; } + + /// + /// Gets enqueue Server SAP IP Address. + /// + [JsonProperty(PropertyName = "ipAddress")] + public string IpAddress { get; private set; } + + /// + /// Gets enqueue Server Port. + /// + [JsonProperty(PropertyName = "port")] + public long? Port { get; private set; } + + /// + /// Gets possible values include: 'Unknown', 'Healthy', 'Unhealthy', + /// 'Degraded' + /// + [JsonProperty(PropertyName = "health")] + public string Health { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Error.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Error.cs new file mode 100644 index 000000000000..7574cd78dd35 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Error.cs @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Standard error object. + /// + public partial class Error + { + /// + /// Initializes a new instance of the Error class. + /// + public Error() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Error class. + /// + /// Server-defined set of error codes. + /// Human-readable representation of the + /// error. + /// Target of the error. + /// Array of details about specific errors that + /// led to this reported error. + /// Object containing more specific + /// information than the current object about the error. + public Error(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), ErrorInnerError innerError = default(ErrorInnerError)) + { + Code = code; + Message = message; + Target = target; + Details = details; + InnerError = innerError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets server-defined set of error codes. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets human-readable representation of the error. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets target of the error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets array of details about specific errors that led to this + /// reported error. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets object containing more specific information than the current + /// object about the error. + /// + [JsonProperty(PropertyName = "innerError")] + public ErrorInnerError InnerError { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..edddde740294 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { + Type = type; + Info = info; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorDefinition.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorDefinition.cs new file mode 100644 index 000000000000..319bed20618b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorDefinition.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Error definition. + /// + public partial class ErrorDefinition + { + /// + /// Initializes a new instance of the ErrorDefinition class. + /// + public ErrorDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDefinition class. + /// + /// Service specific error code which serves as the + /// substatus for the HTTP error code. + /// Description of the error. + /// Internal error details. + public ErrorDefinition(string code = default(string), string message = default(string), IList details = default(IList)) + { + Code = code; + Message = message; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets service specific error code which serves as the substatus for + /// the HTTP error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets description of the error. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets internal error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorDetail.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 000000000000..c1f847e10e01 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorDetail.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The error detail. + /// + public partial class ErrorDetail + { + /// + /// Initializes a new instance of the ErrorDetail class. + /// + public ErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetail class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorInnerError.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorInnerError.cs new file mode 100644 index 000000000000..1622c9d24970 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorInnerError.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Object containing more specific information than the current object + /// about the error. + /// + public partial class ErrorInnerError + { + /// + /// Initializes a new instance of the ErrorInnerError class. + /// + public ErrorInnerError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorInnerError class. + /// + public ErrorInnerError(Error innerError = default(Error)) + { + InnerError = innerError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "innerError")] + public Error InnerError { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorResponse.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..2bf71dcb2de6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error response + /// + /// + /// Common error response for all Azure Resource Manager APIs to return + /// error details for failed operations. (This also follows the OData error + /// response format.). + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The error object. + public ErrorResponse(ErrorDetail error = default(ErrorDetail)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error object. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorResponseException.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..3694312b89e3 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ExternalInstallationSoftwareConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ExternalInstallationSoftwareConfiguration.cs new file mode 100644 index 000000000000..fbf8a5385a8b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ExternalInstallationSoftwareConfiguration.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SAP Software configuration Input when the software is installed + /// externally outside the service. + /// + [Newtonsoft.Json.JsonObject("External")] + public partial class ExternalInstallationSoftwareConfiguration : SoftwareConfiguration + { + /// + /// Initializes a new instance of the + /// ExternalInstallationSoftwareConfiguration class. + /// + public ExternalInstallationSoftwareConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ExternalInstallationSoftwareConfiguration class. + /// + /// The resource ID of the virtual + /// machine containing the central server instance. + public ExternalInstallationSoftwareConfiguration(string centralServerVmId = default(string)) + { + CentralServerVmId = centralServerVmId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the virtual machine containing the + /// central server instance. + /// + [JsonProperty(PropertyName = "centralServerVmId")] + public string CentralServerVmId { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/FileShareStorageType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/FileShareStorageType.cs new file mode 100644 index 000000000000..8392ab534e3b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/FileShareStorageType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for FileShareStorageType. + /// + public static class FileShareStorageType + { + public const string StandardLRS = "Standard_LRS"; + public const string StandardGRS = "Standard_GRS"; + public const string StandardZRS = "Standard_ZRS"; + public const string PremiumLRS = "Premium_LRS"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/FileShareType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/FileShareType.cs new file mode 100644 index 000000000000..08ae1c69c804 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/FileShareType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for FileShareType. + /// + public static class FileShareType + { + public const string NfsOnController = "NfsOnController"; + public const string AzureFiles = "AzureFiles"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/FileshareProfile.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/FileshareProfile.cs new file mode 100644 index 000000000000..7db84af479bc --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/FileshareProfile.cs @@ -0,0 +1,112 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// File share profile + /// + public partial class FileshareProfile + { + /// + /// Initializes a new instance of the FileshareProfile class. + /// + public FileshareProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileshareProfile class. + /// + /// Share type. Possible values include: + /// 'NfsOnController', 'AzureFiles' + /// File share backing storage type. Possible + /// values include: 'Standard_LRS', 'Standard_GRS', 'Standard_ZRS', + /// 'Premium_LRS' + /// File share size in GB + /// File share storage resource + /// id + /// File share name + public FileshareProfile(string shareType, string storageType, long? shareSizeInGB = default(long?), string storageResourceId = default(string), string shareName = default(string)) + { + ShareType = shareType; + StorageType = storageType; + ShareSizeInGB = shareSizeInGB; + StorageResourceId = storageResourceId; + ShareName = shareName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets share type. Possible values include: + /// 'NfsOnController', 'AzureFiles' + /// + [JsonProperty(PropertyName = "shareType")] + public string ShareType { get; set; } + + /// + /// Gets or sets file share backing storage type. Possible values + /// include: 'Standard_LRS', 'Standard_GRS', 'Standard_ZRS', + /// 'Premium_LRS' + /// + [JsonProperty(PropertyName = "storageType")] + public string StorageType { get; set; } + + /// + /// Gets or sets file share size in GB + /// + [JsonProperty(PropertyName = "shareSizeInGB")] + public long? ShareSizeInGB { get; set; } + + /// + /// Gets file share storage resource id + /// + [JsonProperty(PropertyName = "storageResourceId")] + public string StorageResourceId { get; private set; } + + /// + /// Gets file share name + /// + [JsonProperty(PropertyName = "shareName")] + public string ShareName { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ShareType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ShareType"); + } + if (StorageType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageType"); + } + if (ShareSizeInGB < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "ShareSizeInGB", 1); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/GatewayServerProperties.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/GatewayServerProperties.cs new file mode 100644 index 000000000000..df3873aa96db --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/GatewayServerProperties.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the SAP Gateway Server properties. + /// + public partial class GatewayServerProperties + { + /// + /// Initializes a new instance of the GatewayServerProperties class. + /// + public GatewayServerProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GatewayServerProperties class. + /// + /// Gateway Port. + /// Possible values include: 'Unknown', 'Healthy', + /// 'Unhealthy', 'Degraded' + public GatewayServerProperties(long? port = default(long?), string health = default(string)) + { + Port = port; + Health = health; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets gateway Port. + /// + [JsonProperty(PropertyName = "port")] + public long? Port { get; private set; } + + /// + /// Gets possible values include: 'Unknown', 'Healthy', 'Unhealthy', + /// 'Degraded' + /// + [JsonProperty(PropertyName = "health")] + public string Health { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/HAEnabled.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/HAEnabled.cs new file mode 100644 index 000000000000..f40dd7ee2251 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/HAEnabled.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for HAEnabled. + /// + public static class HAEnabled + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/HanaDbProviderInstanceProperties.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/HanaDbProviderInstanceProperties.cs new file mode 100644 index 000000000000..49b532553b7c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/HanaDbProviderInstanceProperties.cs @@ -0,0 +1,126 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the provider properties. + /// + [Newtonsoft.Json.JsonObject("SapHana")] + public partial class HanaDbProviderInstanceProperties : ProviderSpecificProperties + { + /// + /// Initializes a new instance of the HanaDbProviderInstanceProperties + /// class. + /// + public HanaDbProviderInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HanaDbProviderInstanceProperties + /// class. + /// + /// Gets or sets the target virtual machine + /// size. + /// Gets or sets the hana database name. + /// Gets or sets the database sql port. + /// Gets or sets the database instance + /// number. + /// Gets or sets the database user + /// name. + /// Gets or sets the database + /// password. + /// Gets or sets the key vault URI to + /// secret with the database password. + /// Gets or sets the blob URI to SSL + /// certificate for the DB. + /// Gets or sets the hostname(s) + /// in the SSL certificate. + public HanaDbProviderInstanceProperties(string hostname = default(string), string dbName = default(string), string sqlPort = default(string), string instanceNumber = default(string), string dbUsername = default(string), string dbPassword = default(string), string dbPasswordUri = default(string), string dbSslCertificateUri = default(string), string sslHostNameInCertificate = default(string)) + { + Hostname = hostname; + DbName = dbName; + SqlPort = sqlPort; + InstanceNumber = instanceNumber; + DbUsername = dbUsername; + DbPassword = dbPassword; + DbPasswordUri = dbPasswordUri; + DbSslCertificateUri = dbSslCertificateUri; + SslHostNameInCertificate = sslHostNameInCertificate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the target virtual machine size. + /// + [JsonProperty(PropertyName = "hostname")] + public string Hostname { get; set; } + + /// + /// Gets or sets the hana database name. + /// + [JsonProperty(PropertyName = "dbName")] + public string DbName { get; set; } + + /// + /// Gets or sets the database sql port. + /// + [JsonProperty(PropertyName = "sqlPort")] + public string SqlPort { get; set; } + + /// + /// Gets or sets the database instance number. + /// + [JsonProperty(PropertyName = "instanceNumber")] + public string InstanceNumber { get; set; } + + /// + /// Gets or sets the database user name. + /// + [JsonProperty(PropertyName = "dbUsername")] + public string DbUsername { get; set; } + + /// + /// Gets or sets the database password. + /// + [JsonProperty(PropertyName = "dbPassword")] + public string DbPassword { get; set; } + + /// + /// Gets or sets the key vault URI to secret with the database + /// password. + /// + [JsonProperty(PropertyName = "dbPasswordUri")] + public string DbPasswordUri { get; set; } + + /// + /// Gets or sets the blob URI to SSL certificate for the DB. + /// + [JsonProperty(PropertyName = "dbSslCertificateUri")] + public string DbSslCertificateUri { get; set; } + + /// + /// Gets or sets the hostname(s) in the SSL certificate. + /// + [JsonProperty(PropertyName = "sslHostNameInCertificate")] + public string SslHostNameInCertificate { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/HighAvailabilityConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/HighAvailabilityConfiguration.cs new file mode 100644 index 000000000000..e0e2d1d921da --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/HighAvailabilityConfiguration.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the high availability configuration. + /// + public partial class HighAvailabilityConfiguration + { + /// + /// Initializes a new instance of the HighAvailabilityConfiguration + /// class. + /// + public HighAvailabilityConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HighAvailabilityConfiguration + /// class. + /// + /// The high availability type. + /// Possible values include: 'AvailabilitySet', + /// 'AvailabilityZone' + public HighAvailabilityConfiguration(string highAvailabilityType) + { + HighAvailabilityType = highAvailabilityType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the high availability type. Possible values include: + /// 'AvailabilitySet', 'AvailabilityZone' + /// + [JsonProperty(PropertyName = "highAvailabilityType")] + public string HighAvailabilityType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (HighAvailabilityType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "HighAvailabilityType"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/HighAvailabilitySoftwareConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/HighAvailabilitySoftwareConfiguration.cs new file mode 100644 index 000000000000..6da5a8cc36dc --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/HighAvailabilitySoftwareConfiguration.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the HA software configuration. + /// + public partial class HighAvailabilitySoftwareConfiguration + { + /// + /// Initializes a new instance of the + /// HighAvailabilitySoftwareConfiguration class. + /// + public HighAvailabilitySoftwareConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// HighAvailabilitySoftwareConfiguration class. + /// + /// The fencing client id. + /// The fencing client id + /// secret/password. The secret should never expire. This will be used + /// pacemaker to start/stop the cluster VMs. + public HighAvailabilitySoftwareConfiguration(string fencingClientId, string fencingClientPassword) + { + FencingClientId = fencingClientId; + FencingClientPassword = fencingClientPassword; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the fencing client id. + /// + [JsonProperty(PropertyName = "fencingClientId")] + public string FencingClientId { get; set; } + + /// + /// Gets or sets the fencing client id secret/password. The secret + /// should never expire. This will be used pacemaker to start/stop the + /// cluster VMs. + /// + [JsonProperty(PropertyName = "fencingClientPassword")] + public string FencingClientPassword { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (FencingClientId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FencingClientId"); + } + if (FencingClientPassword == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FencingClientPassword"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Identity.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Identity.cs new file mode 100644 index 000000000000..cdc6385159c8 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Identity.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Identity for the resource. + /// + public partial class Identity + { + /// + /// Initializes a new instance of the Identity class. + /// + public Identity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Identity class. + /// + /// The principal ID of resource + /// identity. + /// The tenant ID of resource. + /// The identity type. Possible values include: + /// 'SystemAssigned' + public Identity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal ID of resource identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the tenant ID of resource. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the identity type. Possible values include: + /// 'SystemAssigned' + /// + [JsonProperty(PropertyName = "type")] + public ResourceIdentityType? Type { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ImageReference.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ImageReference.cs new file mode 100644 index 000000000000..5933413e7527 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ImageReference.cs @@ -0,0 +1,119 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies information about the image to use. You can specify + /// information about platform images, marketplace images, or virtual + /// machine images. This element is required when you want to use a + /// platform image, marketplace image, or virtual machine image, but is not + /// used in other creation operations. NOTE: Image reference publisher and + /// offer can only be set when you create the scale set. + /// + public partial class ImageReference + { + /// + /// Initializes a new instance of the ImageReference class. + /// + public ImageReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageReference class. + /// + /// The image publisher. + /// Specifies the offer of the platform image or + /// marketplace image used to create the virtual machine. + /// The image SKU. + /// Specifies the version of the platform image + /// or marketplace image used to create the virtual machine. The + /// allowed formats are Major.Minor.Build or 'latest'. Major, Minor, + /// and Build are decimal numbers. Specify 'latest' to use the latest + /// version of an image available at deploy time. Even if you use + /// 'latest', the VM image will not automatically update after deploy + /// time even if a new version becomes available. + /// Specifies in decimal numbers, the + /// version of platform image or marketplace image used to create the + /// virtual machine. This readonly field differs from 'version', only + /// if the value specified in 'version' field is 'latest'. + /// Specified the shared gallery + /// image unique id for vm deployment. This can be fetched from shared + /// gallery image GET call. + public ImageReference(string publisher = default(string), string offer = default(string), string sku = default(string), string version = default(string), string exactVersion = default(string), string sharedGalleryImageId = default(string)) + { + Publisher = publisher; + Offer = offer; + Sku = sku; + Version = version; + ExactVersion = exactVersion; + SharedGalleryImageId = sharedGalleryImageId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the image publisher. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the offer of the platform image or + /// marketplace image used to create the virtual machine. + /// + [JsonProperty(PropertyName = "offer")] + public string Offer { get; set; } + + /// + /// Gets or sets the image SKU. + /// + [JsonProperty(PropertyName = "sku")] + public string Sku { get; set; } + + /// + /// Gets or sets specifies the version of the platform image or + /// marketplace image used to create the virtual machine. The allowed + /// formats are Major.Minor.Build or 'latest'. Major, Minor, and Build + /// are decimal numbers. Specify 'latest' to use the latest version of + /// an image available at deploy time. Even if you use 'latest', the VM + /// image will not automatically update after deploy time even if a new + /// version becomes available. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Gets specifies in decimal numbers, the version of platform image or + /// marketplace image used to create the virtual machine. This readonly + /// field differs from 'version', only if the value specified in + /// 'version' field is 'latest'. + /// + [JsonProperty(PropertyName = "exactVersion")] + public string ExactVersion { get; private set; } + + /// + /// Gets or sets specified the shared gallery image unique id for vm + /// deployment. This can be fetched from shared gallery image GET call. + /// + [JsonProperty(PropertyName = "sharedGalleryImageId")] + public string SharedGalleryImageId { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/InfrastructureConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/InfrastructureConfiguration.cs new file mode 100644 index 000000000000..ad931c282d11 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/InfrastructureConfiguration.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Deploy SAP Infrastructure Details. + /// + public partial class InfrastructureConfiguration + { + /// + /// Initializes a new instance of the InfrastructureConfiguration + /// class. + /// + public InfrastructureConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InfrastructureConfiguration + /// class. + /// + /// The application resource group where + /// SAP system resources will be deployed. + public InfrastructureConfiguration(string appResourceGroup) + { + AppResourceGroup = appResourceGroup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the application resource group where SAP system + /// resources will be deployed. + /// + [JsonProperty(PropertyName = "appResourceGroup")] + public string AppResourceGroup { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AppResourceGroup == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AppResourceGroup"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/LinuxConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/LinuxConfiguration.cs new file mode 100644 index 000000000000..c9c8144c3144 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/LinuxConfiguration.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the Linux operating system settings on the virtual machine. + /// <br><br>For a list of supported Linux distributions, see + /// [Linux on Azure-Endorsed + /// Distributions](https://docs.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + /// + [Newtonsoft.Json.JsonObject("Linux")] + public partial class LinuxConfiguration : OSConfiguration + { + /// + /// Initializes a new instance of the LinuxConfiguration class. + /// + public LinuxConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinuxConfiguration class. + /// + /// Specifies whether + /// password authentication should be disabled. + /// Specifies the ssh key configuration for a Linux + /// OS. (This property is deprecated, please use 'sshKeyPair' + /// instead) + /// The SSH Key-pair used to authenticate with + /// the VM's. + public LinuxConfiguration(bool? disablePasswordAuthentication = default(bool?), SshConfiguration ssh = default(SshConfiguration), SshKeyPair sshKeyPair = default(SshKeyPair)) + { + DisablePasswordAuthentication = disablePasswordAuthentication; + Ssh = ssh; + SshKeyPair = sshKeyPair; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies whether password authentication should be + /// disabled. + /// + [JsonProperty(PropertyName = "disablePasswordAuthentication")] + public bool? DisablePasswordAuthentication { get; set; } + + /// + /// Gets or sets specifies the ssh key configuration for a Linux OS. + /// (This property is deprecated, please use 'sshKeyPair' instead) + /// + [JsonProperty(PropertyName = "ssh")] + public SshConfiguration Ssh { get; set; } + + /// + /// Gets or sets the SSH Key-pair used to authenticate with the VM's. + /// + [JsonProperty(PropertyName = "sshKeyPair")] + public SshKeyPair SshKeyPair { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/LoadBalancerType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/LoadBalancerType.cs new file mode 100644 index 000000000000..8ac4dc2e4971 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/LoadBalancerType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for LoadBalancerType. + /// + public static class LoadBalancerType + { + public const string ApplicationGateway = "ApplicationGateway"; + public const string LoadBalancer = "LoadBalancer"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/LocationType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/LocationType.cs new file mode 100644 index 000000000000..92d448c393d9 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/LocationType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for LocationType. + /// + public static class LocationType + { + public const string Region = "Region"; + public const string EdgeZone = "EdgeZone"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ManagedRGConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ManagedRGConfiguration.cs new file mode 100644 index 000000000000..831ec26154ab --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ManagedRGConfiguration.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Managed resource group configuration + /// + public partial class ManagedRGConfiguration + { + /// + /// Initializes a new instance of the ManagedRGConfiguration class. + /// + public ManagedRGConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedRGConfiguration class. + /// + /// Managed resource group name + public ManagedRGConfiguration(string name = default(string)) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets managed resource group name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ManagedServiceIdentityType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ManagedServiceIdentityType.cs new file mode 100644 index 000000000000..979b4dea913c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ManagedServiceIdentityType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for ManagedServiceIdentityType. + /// + public static class ManagedServiceIdentityType + { + public const string None = "None"; + public const string UserAssigned = "UserAssigned"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/MessageServerProperties.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/MessageServerProperties.cs new file mode 100644 index 000000000000..f57aa09be324 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/MessageServerProperties.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the SAP Message Server properties. + /// + public partial class MessageServerProperties + { + /// + /// Initializes a new instance of the MessageServerProperties class. + /// + public MessageServerProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MessageServerProperties class. + /// + /// Message Server port. + /// Message Server internal MS + /// port. + /// Message Server HTTP Port. + /// Message Server HTTPS Port. + /// Message Server SAP Hostname. + /// Message server IP Address. + /// Possible values include: 'Unknown', 'Healthy', + /// 'Unhealthy', 'Degraded' + public MessageServerProperties(long? msPort = default(long?), long? internalMsPort = default(long?), long? httpPort = default(long?), long? httpsPort = default(long?), string hostname = default(string), string ipAddress = default(string), string health = default(string)) + { + MsPort = msPort; + InternalMsPort = internalMsPort; + HttpPort = httpPort; + HttpsPort = httpsPort; + Hostname = hostname; + IpAddress = ipAddress; + Health = health; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets message Server port. + /// + [JsonProperty(PropertyName = "msPort")] + public long? MsPort { get; private set; } + + /// + /// Gets message Server internal MS port. + /// + [JsonProperty(PropertyName = "internalMsPort")] + public long? InternalMsPort { get; private set; } + + /// + /// Gets message Server HTTP Port. + /// + [JsonProperty(PropertyName = "httpPort")] + public long? HttpPort { get; private set; } + + /// + /// Gets message Server HTTPS Port. + /// + [JsonProperty(PropertyName = "httpsPort")] + public long? HttpsPort { get; private set; } + + /// + /// Gets message Server SAP Hostname. + /// + [JsonProperty(PropertyName = "hostname")] + public string Hostname { get; private set; } + + /// + /// Gets message server IP Address. + /// + [JsonProperty(PropertyName = "ipAddress")] + public string IpAddress { get; private set; } + + /// + /// Gets possible values include: 'Unknown', 'Healthy', 'Unhealthy', + /// 'Degraded' + /// + [JsonProperty(PropertyName = "health")] + public string Health { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Monitor.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Monitor.cs new file mode 100644 index 000000000000..d6aa373cff96 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Monitor.cs @@ -0,0 +1,175 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// SAP monitor info on Azure (ARM properties and SAP monitor properties) + /// + [Rest.Serialization.JsonTransformation] + public partial class Monitor : TrackedResource + { + /// + /// Initializes a new instance of the Monitor class. + /// + public Monitor() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Monitor class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// State of provisioning of the SAP + /// monitor. Possible values include: 'Accepted', 'Creating', + /// 'Updating', 'Failed', 'Succeeded', 'Deleting', 'Migrating' + /// Defines the SAP monitor errors. + /// The SAP monitor resources will be + /// deployed in the SAP monitoring region. The subnet region should be + /// same as the SAP monitoring region. + /// Sets the routing preference of the + /// SAP monitor. By default only RFC1918 traffic is routed to the + /// customer VNET. Possible values include: 'Default', + /// 'RouteAll' + /// Sets the preference for zone + /// redundancy on resources created for the SAP monitor. By default + /// resources will be created which do not support zone + /// redundancy. + /// Managed resource + /// group configuration + /// The ARM ID of the Log + /// Analytics Workspace that is used for SAP monitoring. + /// The subnet which the SAP monitor will + /// be deployed in + /// The ARM ID of the MSI used for SAP + /// monitoring. + public Monitor(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), UserAssignedServiceIdentity identity = default(UserAssignedServiceIdentity), string provisioningState = default(string), MonitorPropertiesErrors errors = default(MonitorPropertiesErrors), string appLocation = default(string), string routingPreference = default(string), string zoneRedundancyPreference = default(string), ManagedRGConfiguration managedResourceGroupConfiguration = default(ManagedRGConfiguration), string logAnalyticsWorkspaceArmId = default(string), string monitorSubnet = default(string), string msiArmId = default(string)) + : base(location, id, name, type, systemData, tags) + { + Identity = identity; + ProvisioningState = provisioningState; + Errors = errors; + AppLocation = appLocation; + RoutingPreference = routingPreference; + ZoneRedundancyPreference = zoneRedundancyPreference; + ManagedResourceGroupConfiguration = managedResourceGroupConfiguration; + LogAnalyticsWorkspaceArmId = logAnalyticsWorkspaceArmId; + MonitorSubnet = monitorSubnet; + MsiArmId = msiArmId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "identity")] + public UserAssignedServiceIdentity Identity { get; set; } + + /// + /// Gets state of provisioning of the SAP monitor. Possible values + /// include: 'Accepted', 'Creating', 'Updating', 'Failed', 'Succeeded', + /// 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets defines the SAP monitor errors. + /// + [JsonProperty(PropertyName = "properties.errors")] + public MonitorPropertiesErrors Errors { get; private set; } + + /// + /// Gets or sets the SAP monitor resources will be deployed in the SAP + /// monitoring region. The subnet region should be same as the SAP + /// monitoring region. + /// + [JsonProperty(PropertyName = "properties.appLocation")] + public string AppLocation { get; set; } + + /// + /// Gets or sets sets the routing preference of the SAP monitor. By + /// default only RFC1918 traffic is routed to the customer VNET. + /// Possible values include: 'Default', 'RouteAll' + /// + [JsonProperty(PropertyName = "properties.routingPreference")] + public string RoutingPreference { get; set; } + + /// + /// Gets or sets sets the preference for zone redundancy on resources + /// created for the SAP monitor. By default resources will be created + /// which do not support zone redundancy. + /// + [JsonProperty(PropertyName = "properties.zoneRedundancyPreference")] + public string ZoneRedundancyPreference { get; set; } + + /// + /// Gets or sets managed resource group configuration + /// + [JsonProperty(PropertyName = "properties.managedResourceGroupConfiguration")] + public ManagedRGConfiguration ManagedResourceGroupConfiguration { get; set; } + + /// + /// Gets or sets the ARM ID of the Log Analytics Workspace that is used + /// for SAP monitoring. + /// + [JsonProperty(PropertyName = "properties.logAnalyticsWorkspaceArmId")] + public string LogAnalyticsWorkspaceArmId { get; set; } + + /// + /// Gets or sets the subnet which the SAP monitor will be deployed in + /// + [JsonProperty(PropertyName = "properties.monitorSubnet")] + public string MonitorSubnet { get; set; } + + /// + /// Gets the ARM ID of the MSI used for SAP monitoring. + /// + [JsonProperty(PropertyName = "properties.msiArmId")] + public string MsiArmId { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Identity != null) + { + Identity.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/MonitorPropertiesErrors.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/MonitorPropertiesErrors.cs new file mode 100644 index 000000000000..e68e5d14603c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/MonitorPropertiesErrors.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the SAP monitor errors. + /// + public partial class MonitorPropertiesErrors : Error + { + /// + /// Initializes a new instance of the MonitorPropertiesErrors class. + /// + public MonitorPropertiesErrors() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MonitorPropertiesErrors class. + /// + /// Server-defined set of error codes. + /// Human-readable representation of the + /// error. + /// Target of the error. + /// Array of details about specific errors that + /// led to this reported error. + /// Object containing more specific + /// information than the current object about the error. + public MonitorPropertiesErrors(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), ErrorInnerError innerError = default(ErrorInnerError)) + : base(code, message, target, details, innerError) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/MsSqlServerProviderInstanceProperties.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/MsSqlServerProviderInstanceProperties.cs new file mode 100644 index 000000000000..21bb1c18a4cb --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/MsSqlServerProviderInstanceProperties.cs @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the SQL server provider properties. + /// + [Newtonsoft.Json.JsonObject("MsSqlServer")] + public partial class MsSqlServerProviderInstanceProperties : ProviderSpecificProperties + { + /// + /// Initializes a new instance of the + /// MsSqlServerProviderInstanceProperties class. + /// + public MsSqlServerProviderInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MsSqlServerProviderInstanceProperties class. + /// + /// Gets or sets the SQL server host + /// name. + /// Gets or sets the database sql port. + /// Gets or sets the database user + /// name. + /// Gets or sets the database + /// password. + /// Gets or sets the key vault URI to + /// secret with the database password. + /// Gets or sets the SAP System Identifier + public MsSqlServerProviderInstanceProperties(string hostname = default(string), string dbPort = default(string), string dbUsername = default(string), string dbPassword = default(string), string dbPasswordUri = default(string), string sapSid = default(string)) + { + Hostname = hostname; + DbPort = dbPort; + DbUsername = dbUsername; + DbPassword = dbPassword; + DbPasswordUri = dbPasswordUri; + SapSid = sapSid; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the SQL server host name. + /// + [JsonProperty(PropertyName = "hostname")] + public string Hostname { get; set; } + + /// + /// Gets or sets the database sql port. + /// + [JsonProperty(PropertyName = "dbPort")] + public string DbPort { get; set; } + + /// + /// Gets or sets the database user name. + /// + [JsonProperty(PropertyName = "dbUsername")] + public string DbUsername { get; set; } + + /// + /// Gets or sets the database password. + /// + [JsonProperty(PropertyName = "dbPassword")] + public string DbPassword { get; set; } + + /// + /// Gets or sets the key vault URI to secret with the database + /// password. + /// + [JsonProperty(PropertyName = "dbPasswordUri")] + public string DbPasswordUri { get; set; } + + /// + /// Gets or sets the SAP System Identifier + /// + [JsonProperty(PropertyName = "sapSid")] + public string SapSid { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/NetworkConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/NetworkConfiguration.cs new file mode 100644 index 000000000000..22ae601c44cc --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/NetworkConfiguration.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the network configuration type for SAP system infrastructure + /// that is being deployed + /// + public partial class NetworkConfiguration + { + /// + /// Initializes a new instance of the NetworkConfiguration class. + /// + public NetworkConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkConfiguration class. + /// + /// Specifies whether a secondary IP + /// address should be added to the network interface on all VMs of the + /// SAP system being deployed + public NetworkConfiguration(bool? isSecondaryIpEnabled = default(bool?)) + { + IsSecondaryIpEnabled = isSecondaryIpEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies whether a secondary IP address should be + /// added to the network interface on all VMs of the SAP system being + /// deployed + /// + [JsonProperty(PropertyName = "isSecondaryIpEnabled")] + public bool? IsSecondaryIpEnabled { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/NetworkProfile.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/NetworkProfile.cs new file mode 100644 index 000000000000..22da1640b069 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/NetworkProfile.cs @@ -0,0 +1,148 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Network profile + /// + public partial class NetworkProfile + { + /// + /// Initializes a new instance of the NetworkProfile class. + /// + public NetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkProfile class. + /// + /// Load balancer type. Possible values + /// include: 'ApplicationGateway', 'LoadBalancer' + /// Load balancer SKU + /// Load balancer tier + /// Capacity, applicable only for Application + /// Gateway + /// Whether to enable Azure front + /// door. Possible values include: 'Enabled', 'Disabled' + /// Virtual network resource Id + /// Azure Loadbalancer or + /// ApplicationGateway resource Id + /// Azure front door resource + /// id + /// Loadbalancer front-end IP + /// address resource Id + /// List of outbound public + /// IP resource IDs + public NetworkProfile(string loadBalancerType, string loadBalancerSku = default(string), string loadBalancerTier = default(string), int? capacity = default(int?), string azureFrontDoorEnabled = default(string), string vNetResourceId = default(string), string loadBalancerResourceId = default(string), string azureFrontDoorResourceId = default(string), string frontEndPublicIpResourceId = default(string), IList outboundPublicIpResourceIds = default(IList)) + { + LoadBalancerType = loadBalancerType; + LoadBalancerSku = loadBalancerSku; + LoadBalancerTier = loadBalancerTier; + Capacity = capacity; + AzureFrontDoorEnabled = azureFrontDoorEnabled; + VNetResourceId = vNetResourceId; + LoadBalancerResourceId = loadBalancerResourceId; + AzureFrontDoorResourceId = azureFrontDoorResourceId; + FrontEndPublicIpResourceId = frontEndPublicIpResourceId; + OutboundPublicIpResourceIds = outboundPublicIpResourceIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets load balancer type. Possible values include: + /// 'ApplicationGateway', 'LoadBalancer' + /// + [JsonProperty(PropertyName = "loadBalancerType")] + public string LoadBalancerType { get; set; } + + /// + /// Gets or sets load balancer SKU + /// + [JsonProperty(PropertyName = "loadBalancerSku")] + public string LoadBalancerSku { get; set; } + + /// + /// Gets or sets load balancer tier + /// + [JsonProperty(PropertyName = "loadBalancerTier")] + public string LoadBalancerTier { get; set; } + + /// + /// Gets or sets capacity, applicable only for Application Gateway + /// + [JsonProperty(PropertyName = "capacity")] + public int? Capacity { get; set; } + + /// + /// Gets or sets whether to enable Azure front door. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "azureFrontDoorEnabled")] + public string AzureFrontDoorEnabled { get; set; } + + /// + /// Gets virtual network resource Id + /// + [JsonProperty(PropertyName = "vNetResourceId")] + public string VNetResourceId { get; private set; } + + /// + /// Gets azure Loadbalancer or ApplicationGateway resource Id + /// + [JsonProperty(PropertyName = "loadBalancerResourceId")] + public string LoadBalancerResourceId { get; private set; } + + /// + /// Gets azure front door resource id + /// + [JsonProperty(PropertyName = "azureFrontDoorResourceId")] + public string AzureFrontDoorResourceId { get; private set; } + + /// + /// Gets loadbalancer front-end IP address resource Id + /// + [JsonProperty(PropertyName = "frontEndPublicIpResourceId")] + public string FrontEndPublicIpResourceId { get; private set; } + + /// + /// Gets list of outbound public IP resource IDs + /// + [JsonProperty(PropertyName = "outboundPublicIpResourceIds")] + public IList OutboundPublicIpResourceIds { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (LoadBalancerType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "LoadBalancerType"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/NodeProfile.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/NodeProfile.cs new file mode 100644 index 000000000000..812d1469aaba --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/NodeProfile.cs @@ -0,0 +1,131 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// VM or VMSS node profile + /// + public partial class NodeProfile + { + /// + /// Initializes a new instance of the NodeProfile class. + /// + public NodeProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NodeProfile class. + /// + /// VM SKU for node(s) + /// OS image used for creating the nodes + /// OS disk details + /// VM or VMSS name + /// Data disks details. This property is not in + /// use right now + /// VM/VMSS resource ARM Ids + public NodeProfile(string nodeSku, OsImageProfile osImage, DiskInfo osDisk, string name = default(string), IList dataDisks = default(IList), IList nodeResourceIds = default(IList)) + { + Name = name; + NodeSku = nodeSku; + OsImage = osImage; + OsDisk = osDisk; + DataDisks = dataDisks; + NodeResourceIds = nodeResourceIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets VM or VMSS name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets VM SKU for node(s) + /// + [JsonProperty(PropertyName = "nodeSku")] + public string NodeSku { get; set; } + + /// + /// Gets or sets OS image used for creating the nodes + /// + [JsonProperty(PropertyName = "osImage")] + public OsImageProfile OsImage { get; set; } + + /// + /// Gets or sets OS disk details + /// + [JsonProperty(PropertyName = "osDisk")] + public DiskInfo OsDisk { get; set; } + + /// + /// Gets or sets data disks details. This property is not in use right + /// now + /// + [JsonProperty(PropertyName = "dataDisks")] + public IList DataDisks { get; set; } + + /// + /// Gets VM/VMSS resource ARM Ids + /// + [JsonProperty(PropertyName = "nodeResourceIds")] + public IList NodeResourceIds { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (NodeSku == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "NodeSku"); + } + if (OsImage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OsImage"); + } + if (OsDisk == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OsDisk"); + } + if (OsDisk != null) + { + OsDisk.Validate(); + } + if (DataDisks != null) + { + foreach (var element in DataDisks) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSConfiguration.cs new file mode 100644 index 000000000000..4b2c20942651 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSConfiguration.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using System.Linq; + + /// + /// Defines the OS configuration. + /// + public partial class OSConfiguration + { + /// + /// Initializes a new instance of the OSConfiguration class. + /// + public OSConfiguration() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSImageOffer.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSImageOffer.cs new file mode 100644 index 000000000000..55ff15fb3eab --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSImageOffer.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for OSImageOffer. + /// + public static class OSImageOffer + { + public const string UbuntuServer = "UbuntuServer"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSImagePublisher.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSImagePublisher.cs new file mode 100644 index 000000000000..f7300eaad67f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSImagePublisher.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for OSImagePublisher. + /// + public static class OSImagePublisher + { + public const string Canonical = "Canonical"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSImageSku.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSImageSku.cs new file mode 100644 index 000000000000..392bc6022387 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSImageSku.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for OSImageSku. + /// + public static class OSImageSku + { + public const string OneEightFullStopZeroFourHyphenMinusLTS = "18.04-LTS"; + public const string OneSixFullStopZeroFourHyphenMinusLTS = "16.04-LTS"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSImageVersion.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSImageVersion.cs new file mode 100644 index 000000000000..f3abbd4713ee --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSImageVersion.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for OSImageVersion. + /// + public static class OSImageVersion + { + public const string Latest = "latest"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSProfile.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSProfile.cs new file mode 100644 index 000000000000..997fd12da5c8 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OSProfile.cs @@ -0,0 +1,134 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies the operating system settings for the virtual machine. Some + /// of the settings cannot be changed once VM is provisioned. + /// + public partial class OSProfile + { + /// + /// Initializes a new instance of the OSProfile class. + /// + public OSProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSProfile class. + /// + /// Specifies the name of the administrator + /// account. <br><br> This property cannot be updated after + /// the VM is created. <br><br> **Windows-only + /// restriction:** Cannot end in "." <br><br> **Disallowed + /// values:** "administrator", "admin", "user", "user1", "test", + /// "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", + /// "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + /// "john", "owner", "root", "server", "sql", "support", + /// "support_388945a0", "sys", "test2", "test3", "user4", "user5". + /// <br><br> **Minimum-length (Linux):** 1 character + /// <br><br> **Max-length (Linux):** 64 characters + /// <br><br> **Max-length (Windows):** 20 + /// characters. + /// Specifies the password of the + /// administrator account. <br><br> **Minimum-length + /// (Windows):** 8 characters <br><br> **Minimum-length + /// (Linux):** 6 characters <br><br> **Max-length + /// (Windows):** 123 characters <br><br> **Max-length + /// (Linux):** 72 characters <br><br> **Complexity + /// requirements:** 3 out of 4 conditions below need to be fulfilled + /// <br> Has lower characters <br>Has upper characters + /// <br> Has a digit <br> Has a special character (Regex + /// match [\W_]) <br><br> **Disallowed values:** "abc@123", + /// "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", + /// "Password!", "Password1", "Password22", "iloveyou!" + /// <br><br> For resetting the password, see [How to reset + /// the Remote Desktop service or its login password in a Windows + /// VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) + /// <br><br> For resetting root password, see [Manage + /// users, SSH, and check or repair disks on Azure Linux VMs using the + /// VMAccess + /// Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection) + /// Specifies Windows operating system + /// settings on the virtual machine. + public OSProfile(string adminUsername = default(string), string adminPassword = default(string), OSConfiguration osConfiguration = default(OSConfiguration)) + { + AdminUsername = adminUsername; + AdminPassword = adminPassword; + OsConfiguration = osConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the name of the administrator account. + /// &lt;br&gt;&lt;br&gt; This property cannot be + /// updated after the VM is created. + /// &lt;br&gt;&lt;br&gt; **Windows-only restriction:** + /// Cannot end in "." &lt;br&gt;&lt;br&gt; **Disallowed + /// values:** "administrator", "admin", "user", "user1", "test", + /// "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", + /// "adm", "admin2", "aspnet", "backup", "console", "david", "guest", + /// "john", "owner", "root", "server", "sql", "support", + /// "support_388945a0", "sys", "test2", "test3", "user4", "user5". + /// &lt;br&gt;&lt;br&gt; **Minimum-length (Linux):** 1 + /// character &lt;br&gt;&lt;br&gt; **Max-length + /// (Linux):** 64 characters &lt;br&gt;&lt;br&gt; + /// **Max-length (Windows):** 20 characters. + /// + [JsonProperty(PropertyName = "adminUsername")] + public string AdminUsername { get; set; } + + /// + /// Gets or sets specifies the password of the administrator account. + /// &lt;br&gt;&lt;br&gt; **Minimum-length (Windows):** + /// 8 characters &lt;br&gt;&lt;br&gt; **Minimum-length + /// (Linux):** 6 characters &lt;br&gt;&lt;br&gt; + /// **Max-length (Windows):** 123 characters + /// &lt;br&gt;&lt;br&gt; **Max-length (Linux):** 72 + /// characters &lt;br&gt;&lt;br&gt; **Complexity + /// requirements:** 3 out of 4 conditions below need to be fulfilled + /// &lt;br&gt; Has lower characters &lt;br&gt;Has upper + /// characters &lt;br&gt; Has a digit &lt;br&gt; Has a + /// special character (Regex match [\W_]) + /// &lt;br&gt;&lt;br&gt; **Disallowed values:** + /// "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", + /// "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" + /// &lt;br&gt;&lt;br&gt; For resetting the password, + /// see [How to reset the Remote Desktop service or its login password + /// in a Windows + /// VM](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) + /// &lt;br&gt;&lt;br&gt; For resetting root password, + /// see [Manage users, SSH, and check or repair disks on Azure Linux + /// VMs using the VMAccess + /// Extension](https://docs.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection) + /// + [JsonProperty(PropertyName = "adminPassword")] + public string AdminPassword { get; set; } + + /// + /// Gets or sets specifies Windows operating system settings on the + /// virtual machine. + /// + [JsonProperty(PropertyName = "osConfiguration")] + public OSConfiguration OsConfiguration { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Operation.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..60dbd1ddf638 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Operation.cs @@ -0,0 +1,109 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// REST API Operation + /// + /// + /// Details of a REST API operation, returned from the Resource Provider + /// Operations API + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// The name of the operation, as per Resource-Based + /// Access Control (RBAC). Examples: + /// "Microsoft.Compute/virtualMachines/write", + /// "Microsoft.Compute/virtualMachines/capture/action" + /// Whether the operation applies to + /// data-plane. This is "true" for data-plane operations and "false" + /// for ARM/control-plane operations. + /// Localized display information for this + /// particular operation. + /// The intended executor of the operation; as in + /// Resource Based Access Control (RBAC) and audit logs UX. Default + /// value is "user,system". Possible values include: 'user', 'system', + /// 'user,system' + /// Enum. Indicates the action type. + /// "Internal" refers to actions that are for internal only APIs. + /// Possible values include: 'Internal' + public Operation(string name = default(string), bool? isDataAction = default(bool?), OperationDisplay display = default(OperationDisplay), string origin = default(string), string actionType = default(string)) + { + Name = name; + IsDataAction = isDataAction; + Display = display; + Origin = origin; + ActionType = actionType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the operation, as per Resource-Based Access + /// Control (RBAC). Examples: + /// "Microsoft.Compute/virtualMachines/write", + /// "Microsoft.Compute/virtualMachines/capture/action" + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets whether the operation applies to data-plane. This is "true" + /// for data-plane operations and "false" for ARM/control-plane + /// operations. + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { get; private set; } + + /// + /// Gets or sets localized display information for this particular + /// operation. + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + /// + /// Gets the intended executor of the operation; as in Resource Based + /// Access Control (RBAC) and audit logs UX. Default value is + /// "user,system". Possible values include: 'user', 'system', + /// 'user,system' + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; private set; } + + /// + /// Gets enum. Indicates the action type. "Internal" refers to actions + /// that are for internal only APIs. Possible values include: + /// 'Internal' + /// + [JsonProperty(PropertyName = "actionType")] + public string ActionType { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationDisplay.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..f9b7bcd05e20 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Localized display information for this particular operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// The localized friendly form of the resource + /// provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + /// Compute". + /// The localized friendly name of the resource + /// type related to this operation. E.g. "Virtual Machines" or "Job + /// Schedule Collections". + /// The concise, localized friendly name for + /// the operation; suitable for dropdowns. E.g. "Create or Update + /// Virtual Machine", "Restart Virtual Machine". + /// The short, localized friendly description + /// of the operation; suitable for tool tips and detailed + /// views. + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the localized friendly form of the resource provider name, + /// e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; private set; } + + /// + /// Gets the localized friendly name of the resource type related to + /// this operation. E.g. "Virtual Machines" or "Job Schedule + /// Collections". + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; private set; } + + /// + /// Gets the concise, localized friendly name for the operation; + /// suitable for dropdowns. E.g. "Create or Update Virtual Machine", + /// "Restart Virtual Machine". + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; private set; } + + /// + /// Gets the short, localized friendly description of the operation; + /// suitable for tool tips and detailed views. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationProperties.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationProperties.cs new file mode 100644 index 000000000000..fe9ae943884f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationProperties.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for OperationProperties. + /// + public static class OperationProperties + { + public const string NotSpecified = "NotSpecified"; + public const string User = "User"; + public const string System = "System"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationStatusResult.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationStatusResult.cs new file mode 100644 index 000000000000..72129d83eaaf --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationStatusResult.cs @@ -0,0 +1,144 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The current status of an async operation. + /// + public partial class OperationStatusResult + { + /// + /// Initializes a new instance of the OperationStatusResult class. + /// + public OperationStatusResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationStatusResult class. + /// + /// Operation status. + /// Fully qualified ID for the async + /// operation. + /// Name of the async operation. + /// Percent of the operation that is + /// complete. + /// The start time of the operation. + /// The end time of the operation. + /// The operations list. + /// If present, details of the operation + /// error. + public OperationStatusResult(string status, string id = default(string), string name = default(string), double? percentComplete = default(double?), System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), IList operations = default(IList), ErrorDetail error = default(ErrorDetail)) + { + Id = id; + Name = name; + Status = status; + PercentComplete = percentComplete; + StartTime = startTime; + EndTime = endTime; + Operations = operations; + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets fully qualified ID for the async operation. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets name of the async operation. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets operation status. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets percent of the operation that is complete. + /// + [JsonProperty(PropertyName = "percentComplete")] + public double? PercentComplete { get; set; } + + /// + /// Gets or sets the start time of the operation. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + /// + /// Gets or sets the end time of the operation. + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; set; } + + /// + /// Gets or sets the operations list. + /// + [JsonProperty(PropertyName = "operations")] + public IList Operations { get; set; } + + /// + /// Gets or sets if present, details of the operation error. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Status == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + } + if (PercentComplete > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "PercentComplete", 100); + } + if (PercentComplete < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "PercentComplete", 0); + } + if (Operations != null) + { + foreach (var element in Operations) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationsContent.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationsContent.cs new file mode 100644 index 000000000000..a94883a8c9fc --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationsContent.cs @@ -0,0 +1,123 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the workload operation content. + /// + [Rest.Serialization.JsonTransformation] + public partial class OperationsContent : IResource + { + /// + /// Initializes a new instance of the OperationsContent class. + /// + public OperationsContent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationsContent class. + /// + /// Name of the operation. + /// Display information of the operation. + /// Indicates whether the operation applies + /// to data-plane. + /// Defines the workload operation origin. + /// Possible values include: 'NotSpecified', 'User', 'System' + /// Defines the action type of workload + /// operation. Possible values include: 'NotSpecified', + /// 'Internal' + /// Defines the workload operation + /// properties. + public OperationsContent(string operationsContentName, OperationsDefinitionDisplay display, bool? isDataAction = default(bool?), string origin = default(string), string actionType = default(string), object properties = default(object)) + { + OperationsContentName = operationsContentName; + IsDataAction = isDataAction; + Origin = origin; + Display = display; + ActionType = actionType; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the operation. + /// + [JsonProperty(PropertyName = "properties.name")] + public string OperationsContentName { get; set; } + + /// + /// Gets or sets indicates whether the operation applies to data-plane. + /// + [JsonProperty(PropertyName = "properties.isDataAction")] + public bool? IsDataAction { get; set; } + + /// + /// Gets or sets defines the workload operation origin. Possible values + /// include: 'NotSpecified', 'User', 'System' + /// + [JsonProperty(PropertyName = "properties.origin")] + public string Origin { get; set; } + + /// + /// Gets or sets display information of the operation. + /// + [JsonProperty(PropertyName = "properties.display")] + public OperationsDefinitionDisplay Display { get; set; } + + /// + /// Gets or sets defines the action type of workload operation. + /// Possible values include: 'NotSpecified', 'Internal' + /// + [JsonProperty(PropertyName = "properties.actionType")] + public string ActionType { get; set; } + + /// + /// Gets or sets defines the workload operation properties. + /// + [JsonProperty(PropertyName = "properties.properties")] + public object Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OperationsContentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperationsContentName"); + } + if (Display == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Display"); + } + if (Display != null) + { + Display.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationsDefinition.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationsDefinition.cs new file mode 100644 index 000000000000..11f3a267772d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationsDefinition.cs @@ -0,0 +1,120 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of an Operation. + /// + public partial class OperationsDefinition + { + /// + /// Initializes a new instance of the OperationsDefinition class. + /// + public OperationsDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationsDefinition class. + /// + /// Name of the operation. + /// Display information of the operation. + /// Indicates whether the operation applies + /// to data-plane. + /// Defines the workload operation origin. + /// Possible values include: 'NotSpecified', 'User', 'System' + /// Defines the action type of workload + /// operation. Possible values include: 'NotSpecified', + /// 'Internal' + /// Defines the workload operation + /// properties. + public OperationsDefinition(string name, OperationsDefinitionDisplay display, bool? isDataAction = default(bool?), string origin = default(string), string actionType = default(string), object properties = default(object)) + { + Name = name; + IsDataAction = isDataAction; + Origin = origin; + Display = display; + ActionType = actionType; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the operation. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets indicates whether the operation applies to data-plane. + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { get; set; } + + /// + /// Gets or sets defines the workload operation origin. Possible values + /// include: 'NotSpecified', 'User', 'System' + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; set; } + + /// + /// Gets or sets display information of the operation. + /// + [JsonProperty(PropertyName = "display")] + public OperationsDefinitionDisplay Display { get; set; } + + /// + /// Gets or sets defines the action type of workload operation. + /// Possible values include: 'NotSpecified', 'Internal' + /// + [JsonProperty(PropertyName = "actionType")] + public string ActionType { get; set; } + + /// + /// Gets or sets defines the workload operation properties. + /// + [JsonProperty(PropertyName = "properties.properties")] + public object Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Display == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Display"); + } + if (Display != null) + { + Display.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationsDefinitionArrayResponseWithContinuation.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationsDefinitionArrayResponseWithContinuation.cs new file mode 100644 index 000000000000..bdbc41abec20 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationsDefinitionArrayResponseWithContinuation.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the workload operation definition response. + /// + public partial class OperationsDefinitionArrayResponseWithContinuation + { + /// + /// Initializes a new instance of the + /// OperationsDefinitionArrayResponseWithContinuation class. + /// + public OperationsDefinitionArrayResponseWithContinuation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// OperationsDefinitionArrayResponseWithContinuation class. + /// + /// Defines the workload operation definition + /// response properties. + /// The URL to get to the next set of results, + /// if there are any. + public OperationsDefinitionArrayResponseWithContinuation(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets defines the workload operation definition response + /// properties. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets or sets the URL to get to the next set of results, if there + /// are any. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationsDefinitionDisplay.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationsDefinitionDisplay.cs new file mode 100644 index 000000000000..b4ef1d7b8330 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationsDefinitionDisplay.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using System.Linq; + + /// + /// Display information of the operation. + /// + public partial class OperationsDefinitionDisplay : OperationsDisplayDefinition + { + /// + /// Initializes a new instance of the OperationsDefinitionDisplay + /// class. + /// + public OperationsDefinitionDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationsDefinitionDisplay + /// class. + /// + /// Defines the workload provider. + /// Defines the workload resource. + /// Defines the workload operation. + /// Describes the workload operation. + public OperationsDefinitionDisplay(string provider, string resource, string operation, string description) + : base(provider, resource, operation, description) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationsDisplayDefinition.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationsDisplayDefinition.cs new file mode 100644 index 000000000000..71476103d12d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OperationsDisplayDefinition.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the workload operation. + /// + public partial class OperationsDisplayDefinition + { + /// + /// Initializes a new instance of the OperationsDisplayDefinition + /// class. + /// + public OperationsDisplayDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationsDisplayDefinition + /// class. + /// + /// Defines the workload provider. + /// Defines the workload resource. + /// Defines the workload operation. + /// Describes the workload operation. + public OperationsDisplayDefinition(string provider, string resource, string operation, string description) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets defines the workload provider. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets defines the workload resource. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets defines the workload operation. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets describes the workload operation. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Provider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Provider"); + } + if (Resource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Resource"); + } + if (Operation == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Operation"); + } + if (Description == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Description"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Origin.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Origin.cs new file mode 100644 index 000000000000..f1fffb6d3f5d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Origin.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for Origin. + /// + public static class Origin + { + public const string User = "user"; + public const string System = "system"; + public const string Usersystem = "user,system"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OsImageProfile.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OsImageProfile.cs new file mode 100644 index 000000000000..beac865a90c0 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OsImageProfile.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// OS image profile + /// + public partial class OsImageProfile + { + /// + /// Initializes a new instance of the OsImageProfile class. + /// + public OsImageProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OsImageProfile class. + /// + /// OS image publisher. Possible values + /// include: 'Canonical' + /// OS image offer. Possible values include: + /// 'UbuntuServer' + /// OS image sku. Possible values include: + /// '18.04-LTS', '16.04-LTS' + /// OS image version. Possible values include: + /// 'latest' + public OsImageProfile(string publisher = default(string), string offer = default(string), string sku = default(string), string version = default(string)) + { + Publisher = publisher; + Offer = offer; + Sku = sku; + Version = version; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets OS image publisher. Possible values include: + /// 'Canonical' + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets OS image offer. Possible values include: + /// 'UbuntuServer' + /// + [JsonProperty(PropertyName = "offer")] + public string Offer { get; set; } + + /// + /// Gets or sets OS image sku. Possible values include: '18.04-LTS', + /// '16.04-LTS' + /// + [JsonProperty(PropertyName = "sku")] + public string Sku { get; set; } + + /// + /// Gets or sets OS image version. Possible values include: 'latest' + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OsSapConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OsSapConfiguration.cs new file mode 100644 index 000000000000..658bc3eb1325 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/OsSapConfiguration.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the OS and SAP Configurations for Deployment + /// + public partial class OsSapConfiguration + { + /// + /// Initializes a new instance of the OsSapConfiguration class. + /// + public OsSapConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OsSapConfiguration class. + /// + /// The url and storage account ID + /// where deployer VM packages are uploaded + /// The FQDN to set for the SAP system + public OsSapConfiguration(DeployerVmPackages deployerVmPackages = default(DeployerVmPackages), string sapFqdn = default(string)) + { + DeployerVmPackages = deployerVmPackages; + SapFqdn = sapFqdn; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the url and storage account ID where deployer VM + /// packages are uploaded + /// + [JsonProperty(PropertyName = "deployerVmPackages")] + public DeployerVmPackages DeployerVmPackages { get; set; } + + /// + /// Gets or sets the FQDN to set for the SAP system + /// + [JsonProperty(PropertyName = "sapFqdn")] + public string SapFqdn { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PHPVersion.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PHPVersion.cs new file mode 100644 index 000000000000..27ab61a629ab --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PHPVersion.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for PHPVersion. + /// + public static class PHPVersion + { + public const string SevenFullStopTwo = "7.2"; + public const string SevenFullStopThree = "7.3"; + public const string SevenFullStopFour = "7.4"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Page.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Page.cs new file mode 100644 index 000000000000..ece12a20028d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Page.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PatchResourceRequestBody.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PatchResourceRequestBody.cs new file mode 100644 index 000000000000..a725d4a74b63 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PatchResourceRequestBody.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Resource patch request body + /// + public partial class PatchResourceRequestBody + { + /// + /// Initializes a new instance of the PatchResourceRequestBody class. + /// + public PatchResourceRequestBody() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PatchResourceRequestBody class. + /// + /// Resource tags + public PatchResourceRequestBody(IDictionary tags = default(IDictionary), PatchResourceRequestBodyIdentity identity = default(PatchResourceRequestBodyIdentity)) + { + Tags = tags; + Identity = identity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "identity")] + public PatchResourceRequestBodyIdentity Identity { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PatchResourceRequestBodyIdentity.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PatchResourceRequestBodyIdentity.cs new file mode 100644 index 000000000000..b960f9e246dc --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PatchResourceRequestBodyIdentity.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class PatchResourceRequestBodyIdentity : UserAssignedServiceIdentity + { + /// + /// Initializes a new instance of the PatchResourceRequestBodyIdentity + /// class. + /// + public PatchResourceRequestBodyIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PatchResourceRequestBodyIdentity + /// class. + /// + /// Type of manage identity. Possible values + /// include: 'None', 'UserAssigned' + /// User assigned identities + /// dictionary + public PatchResourceRequestBodyIdentity(string type, IDictionary userAssignedIdentities = default(IDictionary)) + : base(type, userAssignedIdentities) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PhpProfile.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PhpProfile.cs new file mode 100644 index 000000000000..183a6741b2e5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PhpProfile.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// PHP profile + /// + public partial class PhpProfile + { + /// + /// Initializes a new instance of the PhpProfile class. + /// + public PhpProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PhpProfile class. + /// + /// PHP version. Possible values include: '7.2', + /// '7.3', '7.4' + public PhpProfile(string version) + { + Version = version; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets PHP version. Possible values include: '7.2', '7.3', + /// '7.4' + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Version"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PhpWorkloadProvisioningState.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PhpWorkloadProvisioningState.cs new file mode 100644 index 000000000000..33176cc25b85 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PhpWorkloadProvisioningState.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for PhpWorkloadProvisioningState. + /// + public static class PhpWorkloadProvisioningState + { + public const string NotSpecified = "NotSpecified"; + public const string Accepted = "Accepted"; + public const string Created = "Created"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + public const string Provisioning = "Provisioning"; + public const string Deleting = "Deleting"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PhpWorkloadResource.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PhpWorkloadResource.cs new file mode 100644 index 000000000000..15b5353b38e7 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PhpWorkloadResource.cs @@ -0,0 +1,291 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Php workload resource + /// + [Rest.Serialization.JsonTransformation] + public partial class PhpWorkloadResource : TrackedResource + { + /// + /// Initializes a new instance of the PhpWorkloadResource class. + /// + public PhpWorkloadResource() + { + DatabaseProfile = new DatabaseProfile(); + CustomInit(); + } + + /// + /// Initializes a new instance of the PhpWorkloadResource class. + /// + /// The geo-location where the resource + /// lives + /// The infra resources for PHP workload will + /// be created in this location + /// Admin user profile used for VM and + /// VMSS + /// VMSS web nodes profile + /// Controller VM profile + /// Database profile + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// Managed resource + /// group configuration of the workload + /// Network profile + /// Site profile + /// File share profile + /// PHP profile + /// Search profile + /// Cache profile + /// Backup profile + /// Php workload resource provisioning + /// state. Possible values include: 'NotSpecified', 'Accepted', + /// 'Created', 'Succeeded', 'Failed', 'Canceled', 'Provisioning', + /// 'Deleting' + /// Php workloads SKU + /// Identity for the resource. Currently not + /// supported + public PhpWorkloadResource(string location, string appLocation, UserProfile adminUserProfile, VmssNodesProfile webNodesProfile, NodeProfile controllerProfile, DatabaseProfile databaseProfile, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), ManagedRGConfiguration managedResourceGroupConfiguration = default(ManagedRGConfiguration), NetworkProfile networkProfile = default(NetworkProfile), SiteProfile siteProfile = default(SiteProfile), FileshareProfile fileshareProfile = default(FileshareProfile), PhpProfile phpProfile = default(PhpProfile), SearchProfile searchProfile = default(SearchProfile), CacheProfile cacheProfile = default(CacheProfile), BackupProfile backupProfile = default(BackupProfile), string provisioningState = default(string), Sku sku = default(Sku), PhpWorkloadResourceIdentity identity = default(PhpWorkloadResourceIdentity)) + : base(location, id, name, type, systemData, tags) + { + AppLocation = appLocation; + ManagedResourceGroupConfiguration = managedResourceGroupConfiguration; + AdminUserProfile = adminUserProfile; + WebNodesProfile = webNodesProfile; + ControllerProfile = controllerProfile; + NetworkProfile = networkProfile; + DatabaseProfile = databaseProfile; + SiteProfile = siteProfile; + FileshareProfile = fileshareProfile; + PhpProfile = phpProfile; + SearchProfile = searchProfile; + CacheProfile = cacheProfile; + BackupProfile = backupProfile; + ProvisioningState = provisioningState; + Sku = sku; + Identity = identity; + CustomInit(); + } + /// + /// Static constructor for PhpWorkloadResource class. + /// + static PhpWorkloadResource() + { + Kind = "WordPress"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the infra resources for PHP workload will be created + /// in this location + /// + [JsonProperty(PropertyName = "properties.appLocation")] + public string AppLocation { get; set; } + + /// + /// Gets or sets managed resource group configuration of the workload + /// + [JsonProperty(PropertyName = "properties.managedResourceGroupConfiguration")] + public ManagedRGConfiguration ManagedResourceGroupConfiguration { get; set; } + + /// + /// Gets or sets admin user profile used for VM and VMSS + /// + [JsonProperty(PropertyName = "properties.adminUserProfile")] + public UserProfile AdminUserProfile { get; set; } + + /// + /// Gets or sets VMSS web nodes profile + /// + [JsonProperty(PropertyName = "properties.webNodesProfile")] + public VmssNodesProfile WebNodesProfile { get; set; } + + /// + /// Gets or sets controller VM profile + /// + [JsonProperty(PropertyName = "properties.controllerProfile")] + public NodeProfile ControllerProfile { get; set; } + + /// + /// Gets or sets network profile + /// + [JsonProperty(PropertyName = "properties.networkProfile")] + public NetworkProfile NetworkProfile { get; set; } + + /// + /// Gets or sets database profile + /// + [JsonProperty(PropertyName = "properties.databaseProfile")] + public DatabaseProfile DatabaseProfile { get; set; } + + /// + /// Gets or sets site profile + /// + [JsonProperty(PropertyName = "properties.siteProfile")] + public SiteProfile SiteProfile { get; set; } + + /// + /// Gets or sets file share profile + /// + [JsonProperty(PropertyName = "properties.fileshareProfile")] + public FileshareProfile FileshareProfile { get; set; } + + /// + /// Gets or sets PHP profile + /// + [JsonProperty(PropertyName = "properties.phpProfile")] + public PhpProfile PhpProfile { get; set; } + + /// + /// Gets or sets search profile + /// + [JsonProperty(PropertyName = "properties.searchProfile")] + public SearchProfile SearchProfile { get; set; } + + /// + /// Gets or sets cache profile + /// + [JsonProperty(PropertyName = "properties.cacheProfile")] + public CacheProfile CacheProfile { get; set; } + + /// + /// Gets or sets backup profile + /// + [JsonProperty(PropertyName = "properties.backupProfile")] + public BackupProfile BackupProfile { get; set; } + + /// + /// Gets php workload resource provisioning state. Possible values + /// include: 'NotSpecified', 'Accepted', 'Created', 'Succeeded', + /// 'Failed', 'Canceled', 'Provisioning', 'Deleting' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets php workloads SKU + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Gets or sets identity for the resource. Currently not supported + /// + [JsonProperty(PropertyName = "identity")] + public PhpWorkloadResourceIdentity Identity { get; set; } + + /// + /// Indicates which kind of php workload this resource represent e.g + /// WordPress + /// + [JsonProperty(PropertyName = "kind")] + public static string Kind { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (AppLocation == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AppLocation"); + } + if (AdminUserProfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AdminUserProfile"); + } + if (WebNodesProfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "WebNodesProfile"); + } + if (ControllerProfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ControllerProfile"); + } + if (DatabaseProfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DatabaseProfile"); + } + if (AdminUserProfile != null) + { + AdminUserProfile.Validate(); + } + if (WebNodesProfile != null) + { + WebNodesProfile.Validate(); + } + if (ControllerProfile != null) + { + ControllerProfile.Validate(); + } + if (NetworkProfile != null) + { + NetworkProfile.Validate(); + } + if (DatabaseProfile != null) + { + DatabaseProfile.Validate(); + } + if (FileshareProfile != null) + { + FileshareProfile.Validate(); + } + if (PhpProfile != null) + { + PhpProfile.Validate(); + } + if (SearchProfile != null) + { + SearchProfile.Validate(); + } + if (CacheProfile != null) + { + CacheProfile.Validate(); + } + if (BackupProfile != null) + { + BackupProfile.Validate(); + } + if (Sku != null) + { + Sku.Validate(); + } + if (Identity != null) + { + Identity.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PhpWorkloadResourceIdentity.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PhpWorkloadResourceIdentity.cs new file mode 100644 index 000000000000..668a2b8a6cc1 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PhpWorkloadResourceIdentity.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Identity for the resource. Currently not supported + /// + public partial class PhpWorkloadResourceIdentity : UserAssignedServiceIdentity + { + /// + /// Initializes a new instance of the PhpWorkloadResourceIdentity + /// class. + /// + public PhpWorkloadResourceIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PhpWorkloadResourceIdentity + /// class. + /// + /// Type of manage identity. Possible values + /// include: 'None', 'UserAssigned' + /// User assigned identities + /// dictionary + public PhpWorkloadResourceIdentity(string type, IDictionary userAssignedIdentities = default(IDictionary)) + : base(type, userAssignedIdentities) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Plan.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Plan.cs new file mode 100644 index 000000000000..a9e7055ca62f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Plan.cs @@ -0,0 +1,116 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Plan for the resource. + /// + public partial class Plan + { + /// + /// Initializes a new instance of the Plan class. + /// + public Plan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Plan class. + /// + /// A user defined name of the 3rd Party Artifact + /// that is being procured. + /// The publisher of the 3rd Party Artifact + /// that is being bought. E.g. NewRelic + /// The 3rd Party artifact that is being + /// procured. E.g. NewRelic. Product maps to the OfferID specified for + /// the artifact at the time of Data Market onboarding. + /// A publisher provided promotion code as + /// provisioned in Data Market for the said product/artifact. + /// The version of the desired + /// product/artifact. + public Plan(string name, string publisher, string product, string promotionCode = default(string), string version = default(string)) + { + Name = name; + Publisher = publisher; + Product = product; + PromotionCode = promotionCode; + Version = version; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a user defined name of the 3rd Party Artifact that is + /// being procured. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the publisher of the 3rd Party Artifact that is being + /// bought. E.g. NewRelic + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets the 3rd Party artifact that is being procured. E.g. + /// NewRelic. Product maps to the OfferID specified for the artifact at + /// the time of Data Market onboarding. + /// + [JsonProperty(PropertyName = "product")] + public string Product { get; set; } + + /// + /// Gets or sets a publisher provided promotion code as provisioned in + /// Data Market for the said product/artifact. + /// + [JsonProperty(PropertyName = "promotionCode")] + public string PromotionCode { get; set; } + + /// + /// Gets or sets the version of the desired product/artifact. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Publisher == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Publisher"); + } + if (Product == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Product"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PrometheusHaClusterProviderInstanceProperties.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PrometheusHaClusterProviderInstanceProperties.cs new file mode 100644 index 000000000000..02ec825a620c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PrometheusHaClusterProviderInstanceProperties.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the PrometheusHaCluster provider properties. + /// + [Newtonsoft.Json.JsonObject("PrometheusHaCluster")] + public partial class PrometheusHaClusterProviderInstanceProperties : ProviderSpecificProperties + { + /// + /// Initializes a new instance of the + /// PrometheusHaClusterProviderInstanceProperties class. + /// + public PrometheusHaClusterProviderInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrometheusHaClusterProviderInstanceProperties class. + /// + /// URL of the Node Exporter + /// endpoint. + /// Gets or sets the target machine + /// name. + /// Gets or sets the cluster sid. + /// Gets or sets the clusterName. + public PrometheusHaClusterProviderInstanceProperties(string prometheusUrl = default(string), string hostname = default(string), string sid = default(string), string clusterName = default(string)) + { + PrometheusUrl = prometheusUrl; + Hostname = hostname; + Sid = sid; + ClusterName = clusterName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URL of the Node Exporter endpoint. + /// + [JsonProperty(PropertyName = "prometheusUrl")] + public string PrometheusUrl { get; set; } + + /// + /// Gets or sets the target machine name. + /// + [JsonProperty(PropertyName = "hostname")] + public string Hostname { get; set; } + + /// + /// Gets or sets the cluster sid. + /// + [JsonProperty(PropertyName = "sid")] + public string Sid { get; set; } + + /// + /// Gets or sets the clusterName. + /// + [JsonProperty(PropertyName = "clusterName")] + public string ClusterName { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PrometheusOSProviderInstanceProperties.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PrometheusOSProviderInstanceProperties.cs new file mode 100644 index 000000000000..f6a76ee4a556 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/PrometheusOSProviderInstanceProperties.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the PrometheusOS provider properties. + /// + [Newtonsoft.Json.JsonObject("PrometheusOS")] + public partial class PrometheusOSProviderInstanceProperties : ProviderSpecificProperties + { + /// + /// Initializes a new instance of the + /// PrometheusOSProviderInstanceProperties class. + /// + public PrometheusOSProviderInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrometheusOSProviderInstanceProperties class. + /// + /// URL of the Node Exporter + /// endpoint + public PrometheusOSProviderInstanceProperties(string prometheusUrl = default(string)) + { + PrometheusUrl = prometheusUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URL of the Node Exporter endpoint + /// + [JsonProperty(PropertyName = "prometheusUrl")] + public string PrometheusUrl { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ProviderInstance.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ProviderInstance.cs new file mode 100644 index 000000000000..d1f904af6d42 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ProviderInstance.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A provider instance associated with SAP monitor. + /// + [Rest.Serialization.JsonTransformation] + public partial class ProviderInstance : ProxyResource + { + /// + /// Initializes a new instance of the ProviderInstance class. + /// + public ProviderInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProviderInstance class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// State of provisioning of the + /// provider instance. Possible values include: 'Accepted', 'Creating', + /// 'Updating', 'Failed', 'Succeeded', 'Deleting', 'Migrating' + /// Defines the provider instance errors. + /// Defines the provider instance + /// errors. + public ProviderInstance(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), UserAssignedServiceIdentity identity = default(UserAssignedServiceIdentity), string provisioningState = default(string), ProviderInstancePropertiesErrors errors = default(ProviderInstancePropertiesErrors), ProviderSpecificProperties providerSettings = default(ProviderSpecificProperties)) + : base(id, name, type, systemData) + { + Identity = identity; + ProvisioningState = provisioningState; + Errors = errors; + ProviderSettings = providerSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "identity")] + public UserAssignedServiceIdentity Identity { get; set; } + + /// + /// Gets state of provisioning of the provider instance. Possible + /// values include: 'Accepted', 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets defines the provider instance errors. + /// + [JsonProperty(PropertyName = "properties.errors")] + public ProviderInstancePropertiesErrors Errors { get; private set; } + + /// + /// Gets or sets defines the provider instance errors. + /// + [JsonProperty(PropertyName = "properties.providerSettings")] + public ProviderSpecificProperties ProviderSettings { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identity != null) + { + Identity.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ProviderInstancePropertiesErrors.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ProviderInstancePropertiesErrors.cs new file mode 100644 index 000000000000..e0370d2e48ee --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ProviderInstancePropertiesErrors.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the provider instance errors. + /// + public partial class ProviderInstancePropertiesErrors : Error + { + /// + /// Initializes a new instance of the ProviderInstancePropertiesErrors + /// class. + /// + public ProviderInstancePropertiesErrors() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProviderInstancePropertiesErrors + /// class. + /// + /// Server-defined set of error codes. + /// Human-readable representation of the + /// error. + /// Target of the error. + /// Array of details about specific errors that + /// led to this reported error. + /// Object containing more specific + /// information than the current object about the error. + public ProviderInstancePropertiesErrors(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), ErrorInnerError innerError = default(ErrorInnerError)) + : base(code, message, target, details, innerError) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ProviderSpecificProperties.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ProviderSpecificProperties.cs new file mode 100644 index 000000000000..6157ed301422 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ProviderSpecificProperties.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using System.Linq; + + /// + /// Gets or sets the provider specific properties. + /// + public partial class ProviderSpecificProperties + { + /// + /// Initializes a new instance of the ProviderSpecificProperties class. + /// + public ProviderSpecificProperties() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ProxyResource.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..c4f443b8c564 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using System.Linq; + + /// + /// Proxy Resource + /// + /// + /// The resource model definition for a Azure Resource Manager proxy + /// resource. It will not have tags and a location + /// + public partial class ProxyResource : Resource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type, systemData) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/RedisCacheFamily.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/RedisCacheFamily.cs new file mode 100644 index 000000000000..39a9e5e8d50a --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/RedisCacheFamily.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for RedisCacheFamily. + /// + public static class RedisCacheFamily + { + public const string C = "C"; + public const string P = "P"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Resource.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Resource.cs new file mode 100644 index 000000000000..22f7888307c0 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Resource.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Resource + /// + /// + /// Common fields that are returned in the response for all Azure Resource + /// Manager resources + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public Resource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + { + Id = id; + Name = name; + Type = type; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ResourceIdentityType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 000000000000..d1e3f5ab10c7 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ResourceIdentityType.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResourceIdentityType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResourceIdentityType + { + [EnumMember(Value = "SystemAssigned")] + SystemAssigned + } + internal static class ResourceIdentityTypeEnumExtension + { + internal static string ToSerializedValue(this ResourceIdentityType? value) + { + return value == null ? null : ((ResourceIdentityType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResourceIdentityType value) + { + switch( value ) + { + case ResourceIdentityType.SystemAssigned: + return "SystemAssigned"; + } + return null; + } + + internal static ResourceIdentityType? ParseResourceIdentityType(this string value) + { + switch( value ) + { + case "SystemAssigned": + return ResourceIdentityType.SystemAssigned; + } + return null; + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ResourceModelWithAllowedPropertySet.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ResourceModelWithAllowedPropertySet.cs new file mode 100644 index 000000000000..92f8206c6f4c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ResourceModelWithAllowedPropertySet.cs @@ -0,0 +1,141 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource model definition containing the full set of allowed + /// properties for a resource. Except properties bag, there cannot be a top + /// level property outside of this set. + /// + public partial class ResourceModelWithAllowedPropertySet : IResource + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySet class. + /// + public ResourceModelWithAllowedPropertySet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySet class. + /// + /// The fully qualified resource ID of the + /// resource that manages this resource. Indicates if this resource is + /// managed by another Azure resource. If this is present, complete + /// mode deployment will not delete the resource if it is removed from + /// the template since it is managed by another resource. + /// Metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type; e.g. + /// ApiApps are a kind of Microsoft.Web/sites type. If supported, the + /// resource provider must validate and persist this value. + /// The etag field is *not* required. If it is + /// provided in the response body, it must also be provided as a header + /// per the normal etag convention. Entity tags are used for comparing + /// two or more entities from the same requested resource. HTTP/1.1 + /// uses entity tags in the etag (section 14.19), If-Match (section + /// 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) + /// header fields. + public ResourceModelWithAllowedPropertySet(string managedBy = default(string), string kind = default(string), string etag = default(string), ResourceModelWithAllowedPropertySetIdentity identity = default(ResourceModelWithAllowedPropertySetIdentity), ResourceModelWithAllowedPropertySetSku sku = default(ResourceModelWithAllowedPropertySetSku), ResourceModelWithAllowedPropertySetPlan plan = default(ResourceModelWithAllowedPropertySetPlan)) + { + ManagedBy = managedBy; + Kind = kind; + Etag = etag; + Identity = identity; + Sku = sku; + Plan = plan; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the fully qualified resource ID of the resource that + /// manages this resource. Indicates if this resource is managed by + /// another Azure resource. If this is present, complete mode + /// deployment will not delete the resource if it is removed from the + /// template since it is managed by another resource. + /// + [JsonProperty(PropertyName = "managedBy")] + public string ManagedBy { get; set; } + + /// + /// Gets or sets metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type; e.g. + /// ApiApps are a kind of Microsoft.Web/sites type. If supported, the + /// resource provider must validate and persist this value. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets the etag field is *not* required. If it is provided in the + /// response body, it must also be provided as a header per the normal + /// etag convention. Entity tags are used for comparing two or more + /// entities from the same requested resource. HTTP/1.1 uses entity + /// tags in the etag (section 14.19), If-Match (section 14.24), + /// If-None-Match (section 14.26), and If-Range (section 14.27) header + /// fields. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "identity")] + public ResourceModelWithAllowedPropertySetIdentity Identity { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public ResourceModelWithAllowedPropertySetSku Sku { get; set; } + + /// + /// + [JsonProperty(PropertyName = "plan")] + public ResourceModelWithAllowedPropertySetPlan Plan { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Kind != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Kind, "^[-\\w\\._,\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "Kind", "^[-\\w\\._,\\(\\)]+$"); + } + } + if (Sku != null) + { + Sku.Validate(); + } + if (Plan != null) + { + Plan.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs new file mode 100644 index 000000000000..e032afb531ef --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs @@ -0,0 +1,47 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using System.Linq; + + public partial class ResourceModelWithAllowedPropertySetIdentity : Identity + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetIdentity class. + /// + public ResourceModelWithAllowedPropertySetIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetIdentity class. + /// + /// The principal ID of resource + /// identity. + /// The tenant ID of resource. + /// The identity type. Possible values include: + /// 'SystemAssigned' + public ResourceModelWithAllowedPropertySetIdentity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?)) + : base(principalId, tenantId, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs new file mode 100644 index 000000000000..b756da19499e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using System.Linq; + + public partial class ResourceModelWithAllowedPropertySetPlan : Plan + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetPlan class. + /// + public ResourceModelWithAllowedPropertySetPlan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetPlan class. + /// + /// A user defined name of the 3rd Party Artifact + /// that is being procured. + /// The publisher of the 3rd Party Artifact + /// that is being bought. E.g. NewRelic + /// The 3rd Party artifact that is being + /// procured. E.g. NewRelic. Product maps to the OfferID specified for + /// the artifact at the time of Data Market onboarding. + /// A publisher provided promotion code as + /// provisioned in Data Market for the said product/artifact. + /// The version of the desired + /// product/artifact. + public ResourceModelWithAllowedPropertySetPlan(string name, string publisher, string product, string promotionCode = default(string), string version = default(string)) + : base(name, publisher, product, promotionCode, version) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs new file mode 100644 index 000000000000..63fbae6e71c0 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using System.Linq; + + public partial class ResourceModelWithAllowedPropertySetSku : Sku + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetSku class. + /// + public ResourceModelWithAllowedPropertySetSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetSku class. + /// + /// The name of the SKU. Ex - P3. It is typically a + /// letter+number code + /// Possible values include: 'Free', 'Basic', + /// 'Standard', 'Premium' + /// The SKU size. When the name field is the + /// combination of tier and some other value, this would be the + /// standalone code. + /// If the service has different generations of + /// hardware, for the same SKU, then that can be captured here. + /// If the SKU supports scale out/in then the + /// capacity integer should be included. If scale out/in is not + /// possible for the resource this may be omitted. + public ResourceModelWithAllowedPropertySetSku(string name, SkuTier? tier = default(SkuTier?), string size = default(string), string family = default(string), int? capacity = default(int?)) + : base(name, tier, size, family, capacity) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/RestrictionInfo.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/RestrictionInfo.cs new file mode 100644 index 000000000000..37ca42e60767 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/RestrictionInfo.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The SKU restriction information. + /// + public partial class RestrictionInfo + { + /// + /// Initializes a new instance of the RestrictionInfo class. + /// + public RestrictionInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestrictionInfo class. + /// + /// The restriction locations. + /// The restriction zones. + public RestrictionInfo(IList locations = default(IList), IList zones = default(IList)) + { + Locations = locations; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the restriction locations. + /// + [JsonProperty(PropertyName = "locations")] + public IList Locations { get; set; } + + /// + /// Gets or sets the restriction zones. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/RoutingPreference.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/RoutingPreference.cs new file mode 100644 index 000000000000..36b3fad71752 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/RoutingPreference.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for RoutingPreference. + /// + public static class RoutingPreference + { + public const string Default = "Default"; + public const string RouteAll = "RouteAll"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPApplicationServerInstance.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPApplicationServerInstance.cs new file mode 100644 index 000000000000..edb2f8e33972 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPApplicationServerInstance.cs @@ -0,0 +1,200 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Define the SAP Application Server Instance resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class SAPApplicationServerInstance : TrackedResource + { + /// + /// Initializes a new instance of the SAPApplicationServerInstance + /// class. + /// + public SAPApplicationServerInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPApplicationServerInstance + /// class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// Application server Instance + /// Number. + /// Application server Subnet. + /// Application server instance SAP + /// hostname. + /// Application server instance SAP Kernel + /// Version. + /// Application server instance SAP Kernel + /// Patch level. + /// Application server instance SAP IP + /// Address. + /// Application server instance gateway + /// Port. + /// Application server instance ICM HTTP + /// Port. + /// Application server instance ICM HTTPS + /// Port. + /// The virtual machine. + /// Possible values include: 'Starting', + /// 'Running', 'Stopping', 'Offline', 'PartiallyRunning', + /// 'Unavailable' + /// Possible values include: 'Unknown', 'Healthy', + /// 'Unhealthy', 'Degraded' + /// Possible values include: + /// 'Succeeded', 'Updating', 'Creating', 'Failed', 'Deleting' + /// Defines the Application Instance + /// errors. + public SAPApplicationServerInstance(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), string instanceNo = default(string), string subnet = default(string), string hostname = default(string), string kernelVersion = default(string), string kernelPatch = default(string), string ipAddress = default(string), long? gatewayPort = default(long?), long? icmHttpPort = default(long?), long? icmHttpsPort = default(long?), string virtualMachineId = default(string), string status = default(string), string health = default(string), string provisioningState = default(string), SAPVirtualInstanceError errors = default(SAPVirtualInstanceError)) + : base(location, id, name, type, systemData, tags) + { + InstanceNo = instanceNo; + Subnet = subnet; + Hostname = hostname; + KernelVersion = kernelVersion; + KernelPatch = kernelPatch; + IpAddress = ipAddress; + GatewayPort = gatewayPort; + IcmHttpPort = icmHttpPort; + IcmHttpsPort = icmHttpsPort; + VirtualMachineId = virtualMachineId; + Status = status; + Health = health; + ProvisioningState = provisioningState; + Errors = errors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets application server Instance Number. + /// + [JsonProperty(PropertyName = "properties.instanceNo")] + public string InstanceNo { get; private set; } + + /// + /// Gets application server Subnet. + /// + [JsonProperty(PropertyName = "properties.subnet")] + public string Subnet { get; private set; } + + /// + /// Gets application server instance SAP hostname. + /// + [JsonProperty(PropertyName = "properties.hostname")] + public string Hostname { get; private set; } + + /// + /// Gets Application server instance SAP Kernel Version. + /// + [JsonProperty(PropertyName = "properties.kernelVersion")] + public string KernelVersion { get; private set; } + + /// + /// Gets application server instance SAP Kernel Patch level. + /// + [JsonProperty(PropertyName = "properties.kernelPatch")] + public string KernelPatch { get; private set; } + + /// + /// Gets Application server instance SAP IP Address. + /// + [JsonProperty(PropertyName = "properties.ipAddress")] + public string IpAddress { get; private set; } + + /// + /// Gets application server instance gateway Port. + /// + [JsonProperty(PropertyName = "properties.gatewayPort")] + public long? GatewayPort { get; private set; } + + /// + /// Gets application server instance ICM HTTP Port. + /// + [JsonProperty(PropertyName = "properties.icmHttpPort")] + public long? IcmHttpPort { get; private set; } + + /// + /// Gets application server instance ICM HTTPS Port. + /// + [JsonProperty(PropertyName = "properties.icmHttpsPort")] + public long? IcmHttpsPort { get; private set; } + + /// + /// Gets the virtual machine. + /// + [JsonProperty(PropertyName = "properties.virtualMachineId")] + public string VirtualMachineId { get; private set; } + + /// + /// Gets possible values include: 'Starting', 'Running', 'Stopping', + /// 'Offline', 'PartiallyRunning', 'Unavailable' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets possible values include: 'Unknown', 'Healthy', 'Unhealthy', + /// 'Degraded' + /// + [JsonProperty(PropertyName = "properties.health")] + public string Health { get; private set; } + + /// + /// Gets possible values include: 'Succeeded', 'Updating', 'Creating', + /// 'Failed', 'Deleting' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets defines the Application Instance errors. + /// + [JsonProperty(PropertyName = "properties.errors")] + public SAPVirtualInstanceError Errors { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPAvailabilityZoneDetailsRequest.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPAvailabilityZoneDetailsRequest.cs new file mode 100644 index 000000000000..00eb7c20d693 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPAvailabilityZoneDetailsRequest.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SAP request to get list of availability zones. + /// + public partial class SAPAvailabilityZoneDetailsRequest + { + /// + /// Initializes a new instance of the SAPAvailabilityZoneDetailsRequest + /// class. + /// + public SAPAvailabilityZoneDetailsRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPAvailabilityZoneDetailsRequest + /// class. + /// + /// The geo-location where the SAP resources + /// will be created. + /// Possible values include: 'ECC', 'S4HANA', + /// 'Other' + /// The database type. Eg: HANA, DB2, etc. + /// Possible values include: 'HANA', 'DB2' + public SAPAvailabilityZoneDetailsRequest(string appLocation, string sapProduct, string databaseType) + { + AppLocation = appLocation; + SapProduct = sapProduct; + DatabaseType = databaseType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the geo-location where the SAP resources will be + /// created. + /// + [JsonProperty(PropertyName = "appLocation")] + public string AppLocation { get; set; } + + /// + /// Gets or sets possible values include: 'ECC', 'S4HANA', 'Other' + /// + [JsonProperty(PropertyName = "sapProduct")] + public string SapProduct { get; set; } + + /// + /// Gets or sets the database type. Eg: HANA, DB2, etc. Possible values + /// include: 'HANA', 'DB2' + /// + [JsonProperty(PropertyName = "databaseType")] + public string DatabaseType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AppLocation == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AppLocation"); + } + if (SapProduct == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SapProduct"); + } + if (DatabaseType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DatabaseType"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPAvailabilityZoneDetailsResult.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPAvailabilityZoneDetailsResult.cs new file mode 100644 index 000000000000..03de80884153 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPAvailabilityZoneDetailsResult.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list of supported availability zone pairs which are part of SAP HA + /// deployment. + /// + public partial class SAPAvailabilityZoneDetailsResult + { + /// + /// Initializes a new instance of the SAPAvailabilityZoneDetailsResult + /// class. + /// + public SAPAvailabilityZoneDetailsResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPAvailabilityZoneDetailsResult + /// class. + /// + /// Gets the list of availability + /// zone pairs. + public SAPAvailabilityZoneDetailsResult(IList availabilityZonePairs = default(IList)) + { + AvailabilityZonePairs = availabilityZonePairs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the list of availability zone pairs. + /// + [JsonProperty(PropertyName = "availabilityZonePairs")] + public IList AvailabilityZonePairs { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPAvailabilityZonePair.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPAvailabilityZonePair.cs new file mode 100644 index 000000000000..ca5a83279604 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPAvailabilityZonePair.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SAP Availability Zone Pair. + /// + public partial class SAPAvailabilityZonePair + { + /// + /// Initializes a new instance of the SAPAvailabilityZonePair class. + /// + public SAPAvailabilityZonePair() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPAvailabilityZonePair class. + /// + /// The zone A. + /// The zone B. + public SAPAvailabilityZonePair(long? zoneA = default(long?), long? zoneB = default(long?)) + { + ZoneA = zoneA; + ZoneB = zoneB; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the zone A. + /// + [JsonProperty(PropertyName = "zoneA")] + public long? ZoneA { get; set; } + + /// + /// Gets or sets the zone B. + /// + [JsonProperty(PropertyName = "zoneB")] + public long? ZoneB { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPCentralServerInstance.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPCentralServerInstance.cs new file mode 100644 index 000000000000..c943925a1b23 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPCentralServerInstance.cs @@ -0,0 +1,180 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Define the SAP Central Services Instance resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class SAPCentralServerInstance : TrackedResource + { + /// + /// Initializes a new instance of the SAPCentralServerInstance class. + /// + public SAPCentralServerInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPCentralServerInstance class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// The central services instance + /// number. + /// The central services instance subnet. + /// The central services instance Kernel + /// Version. + /// The central services instance Kernel + /// Patch level. + /// The list of virtual machines corresponding + /// to the Central Services instance. + /// Possible values include: 'Starting', + /// 'Running', 'Stopping', 'Offline', 'PartiallyRunning', + /// 'Unavailable' + /// Possible values include: 'Unknown', 'Healthy', + /// 'Unhealthy', 'Degraded' + /// Possible values include: + /// 'Succeeded', 'Updating', 'Creating', 'Failed', 'Deleting' + /// Defines the errors related to SAP Central + /// Services Instance resource. + public SAPCentralServerInstance(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), string instanceNo = default(string), string subnet = default(string), MessageServerProperties messageServerProperties = default(MessageServerProperties), EnqueueServerProperties enqueueServerProperties = default(EnqueueServerProperties), GatewayServerProperties gatewayServerProperties = default(GatewayServerProperties), EnqueueReplicationServerProperties enqueueReplicationServerProperties = default(EnqueueReplicationServerProperties), string kernelVersion = default(string), string kernelPatch = default(string), IList vmDetails = default(IList), string status = default(string), string health = default(string), string provisioningState = default(string), SAPVirtualInstanceError errors = default(SAPVirtualInstanceError)) + : base(location, id, name, type, systemData, tags) + { + InstanceNo = instanceNo; + Subnet = subnet; + MessageServerProperties = messageServerProperties; + EnqueueServerProperties = enqueueServerProperties; + GatewayServerProperties = gatewayServerProperties; + EnqueueReplicationServerProperties = enqueueReplicationServerProperties; + KernelVersion = kernelVersion; + KernelPatch = kernelPatch; + VmDetails = vmDetails; + Status = status; + Health = health; + ProvisioningState = provisioningState; + Errors = errors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the central services instance number. + /// + [JsonProperty(PropertyName = "properties.instanceNo")] + public string InstanceNo { get; private set; } + + /// + /// Gets the central services instance subnet. + /// + [JsonProperty(PropertyName = "properties.subnet")] + public string Subnet { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.messageServerProperties")] + public MessageServerProperties MessageServerProperties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.enqueueServerProperties")] + public EnqueueServerProperties EnqueueServerProperties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.gatewayServerProperties")] + public GatewayServerProperties GatewayServerProperties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.enqueueReplicationServerProperties")] + public EnqueueReplicationServerProperties EnqueueReplicationServerProperties { get; set; } + + /// + /// Gets the central services instance Kernel Version. + /// + [JsonProperty(PropertyName = "properties.kernelVersion")] + public string KernelVersion { get; private set; } + + /// + /// Gets the central services instance Kernel Patch level. + /// + [JsonProperty(PropertyName = "properties.kernelPatch")] + public string KernelPatch { get; private set; } + + /// + /// Gets the list of virtual machines corresponding to the Central + /// Services instance. + /// + [JsonProperty(PropertyName = "properties.vmDetails")] + public IList VmDetails { get; private set; } + + /// + /// Gets possible values include: 'Starting', 'Running', 'Stopping', + /// 'Offline', 'PartiallyRunning', 'Unavailable' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets possible values include: 'Unknown', 'Healthy', 'Unhealthy', + /// 'Degraded' + /// + [JsonProperty(PropertyName = "properties.health")] + public string Health { get; private set; } + + /// + /// Gets possible values include: 'Succeeded', 'Updating', 'Creating', + /// 'Failed', 'Deleting' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets defines the errors related to SAP Central Services Instance + /// resource. + /// + [JsonProperty(PropertyName = "properties.errors")] + public SAPVirtualInstanceError Errors { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPConfiguration.cs new file mode 100644 index 000000000000..d92cc5d1e450 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPConfiguration.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using System.Linq; + + /// + /// The SAP Configuration. + /// + public partial class SAPConfiguration + { + /// + /// Initializes a new instance of the SAPConfiguration class. + /// + public SAPConfiguration() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPConfigurationType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPConfigurationType.cs new file mode 100644 index 000000000000..28b79f3a9dba --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPConfigurationType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for SAPConfigurationType. + /// + public static class SAPConfigurationType + { + public const string Deployment = "Deployment"; + public const string Discovery = "Discovery"; + public const string DeploymentWithOSConfig = "DeploymentWithOSConfig"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDatabaseInstance.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDatabaseInstance.cs new file mode 100644 index 000000000000..cc2caa6d3238 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDatabaseInstance.cs @@ -0,0 +1,144 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Define the Database resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class SAPDatabaseInstance : TrackedResource + { + /// + /// Initializes a new instance of the SAPDatabaseInstance class. + /// + public SAPDatabaseInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPDatabaseInstance class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// Database subnet. + /// Database SID name. + /// Database type, that is if the DB is + /// HANA, DB2, Oracle, SAP ASE, Max DB or MS SQL Server. + /// Database IP Address. + /// The list of virtual machines corresponding + /// to the Database resource. + /// Possible values include: 'Starting', + /// 'Running', 'Stopping', 'Offline', 'PartiallyRunning', + /// 'Unavailable' + /// Possible values include: + /// 'Succeeded', 'Updating', 'Creating', 'Failed', 'Deleting' + /// Defines the errors related to Database + /// resource. + public SAPDatabaseInstance(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), string subnet = default(string), string databaseSid = default(string), string databaseType = default(string), string ipAddress = default(string), IList vmDetails = default(IList), string status = default(string), string provisioningState = default(string), SAPVirtualInstanceError errors = default(SAPVirtualInstanceError)) + : base(location, id, name, type, systemData, tags) + { + Subnet = subnet; + DatabaseSid = databaseSid; + DatabaseType = databaseType; + IpAddress = ipAddress; + VmDetails = vmDetails; + Status = status; + ProvisioningState = provisioningState; + Errors = errors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets database subnet. + /// + [JsonProperty(PropertyName = "properties.subnet")] + public string Subnet { get; private set; } + + /// + /// Gets database SID name. + /// + [JsonProperty(PropertyName = "properties.databaseSid")] + public string DatabaseSid { get; private set; } + + /// + /// Gets database type, that is if the DB is HANA, DB2, Oracle, SAP + /// ASE, Max DB or MS SQL Server. + /// + [JsonProperty(PropertyName = "properties.databaseType")] + public string DatabaseType { get; private set; } + + /// + /// Gets database IP Address. + /// + [JsonProperty(PropertyName = "properties.ipAddress")] + public string IpAddress { get; private set; } + + /// + /// Gets the list of virtual machines corresponding to the Database + /// resource. + /// + [JsonProperty(PropertyName = "properties.vmDetails")] + public IList VmDetails { get; private set; } + + /// + /// Gets possible values include: 'Starting', 'Running', 'Stopping', + /// 'Offline', 'PartiallyRunning', 'Unavailable' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets possible values include: 'Succeeded', 'Updating', 'Creating', + /// 'Failed', 'Deleting' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets defines the errors related to Database resource. + /// + [JsonProperty(PropertyName = "properties.errors")] + public SAPVirtualInstanceError Errors { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDatabaseScaleMethod.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDatabaseScaleMethod.cs new file mode 100644 index 000000000000..da927590e9c9 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDatabaseScaleMethod.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for SAPDatabaseScaleMethod. + /// + public static class SAPDatabaseScaleMethod + { + public const string ScaleUp = "ScaleUp"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDatabaseType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDatabaseType.cs new file mode 100644 index 000000000000..ef8a3dbbd9da --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDatabaseType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for SAPDatabaseType. + /// + public static class SAPDatabaseType + { + public const string HANA = "HANA"; + public const string DB2 = "DB2"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDeploymentType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDeploymentType.cs new file mode 100644 index 000000000000..624ff94b8518 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDeploymentType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for SAPDeploymentType. + /// + public static class SAPDeploymentType + { + public const string SingleServer = "SingleServer"; + public const string ThreeTier = "ThreeTier"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDiskConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDiskConfiguration.cs new file mode 100644 index 000000000000..43ef354f4790 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDiskConfiguration.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SAP Disk Configuration. + /// + public partial class SAPDiskConfiguration + { + /// + /// Initializes a new instance of the SAPDiskConfiguration class. + /// + public SAPDiskConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPDiskConfiguration class. + /// + /// The volume name. + /// The disk type. + /// The disk count. + /// The disk size in GB. + /// The disk Iops. + /// The disk provisioned throughput in + /// MBps. + /// The disk storage type + public SAPDiskConfiguration(string volume = default(string), string diskType = default(string), long? diskCount = default(long?), long? diskSizeGB = default(long?), long? diskIopsReadWrite = default(long?), long? diskMBpsReadWrite = default(long?), string diskStorageType = default(string)) + { + Volume = volume; + DiskType = diskType; + DiskCount = diskCount; + DiskSizeGB = diskSizeGB; + DiskIopsReadWrite = diskIopsReadWrite; + DiskMBpsReadWrite = diskMBpsReadWrite; + DiskStorageType = diskStorageType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the volume name. + /// + [JsonProperty(PropertyName = "volume")] + public string Volume { get; set; } + + /// + /// Gets or sets the disk type. + /// + [JsonProperty(PropertyName = "diskType")] + public string DiskType { get; set; } + + /// + /// Gets or sets the disk count. + /// + [JsonProperty(PropertyName = "diskCount")] + public long? DiskCount { get; set; } + + /// + /// Gets or sets the disk size in GB. + /// + [JsonProperty(PropertyName = "diskSizeGB")] + public long? DiskSizeGB { get; set; } + + /// + /// Gets or sets the disk Iops. + /// + [JsonProperty(PropertyName = "diskIopsReadWrite")] + public long? DiskIopsReadWrite { get; set; } + + /// + /// Gets or sets the disk provisioned throughput in MBps. + /// + [JsonProperty(PropertyName = "diskMBpsReadWrite")] + public long? DiskMBpsReadWrite { get; set; } + + /// + /// Gets or sets the disk storage type + /// + [JsonProperty(PropertyName = "diskStorageType")] + public string DiskStorageType { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDiskConfigurationsRequest.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDiskConfigurationsRequest.cs new file mode 100644 index 000000000000..5cc3e0cf7c56 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDiskConfigurationsRequest.cs @@ -0,0 +1,136 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SAP request to get list of disk configurations. + /// + public partial class SAPDiskConfigurationsRequest + { + /// + /// Initializes a new instance of the SAPDiskConfigurationsRequest + /// class. + /// + public SAPDiskConfigurationsRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPDiskConfigurationsRequest + /// class. + /// + /// The geo-location where the SAP resources + /// will be created. + /// Possible values include: 'NonProd', + /// 'Prod' + /// Possible values include: 'ECC', 'S4HANA', + /// 'Other' + /// The database type. Eg: HANA, DB2, etc. + /// Possible values include: 'HANA', 'DB2' + /// The deployment type. Eg: + /// SingleServer/ThreeTier. Possible values include: 'SingleServer', + /// 'ThreeTier' + /// The VM SKU for database instance. + public SAPDiskConfigurationsRequest(string appLocation, string environment, string sapProduct, string databaseType, string deploymentType, string dbVmSku) + { + AppLocation = appLocation; + Environment = environment; + SapProduct = sapProduct; + DatabaseType = databaseType; + DeploymentType = deploymentType; + DbVmSku = dbVmSku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the geo-location where the SAP resources will be + /// created. + /// + [JsonProperty(PropertyName = "appLocation")] + public string AppLocation { get; set; } + + /// + /// Gets or sets possible values include: 'NonProd', 'Prod' + /// + [JsonProperty(PropertyName = "environment")] + public string Environment { get; set; } + + /// + /// Gets or sets possible values include: 'ECC', 'S4HANA', 'Other' + /// + [JsonProperty(PropertyName = "sapProduct")] + public string SapProduct { get; set; } + + /// + /// Gets or sets the database type. Eg: HANA, DB2, etc. Possible values + /// include: 'HANA', 'DB2' + /// + [JsonProperty(PropertyName = "databaseType")] + public string DatabaseType { get; set; } + + /// + /// Gets or sets the deployment type. Eg: SingleServer/ThreeTier. + /// Possible values include: 'SingleServer', 'ThreeTier' + /// + [JsonProperty(PropertyName = "deploymentType")] + public string DeploymentType { get; set; } + + /// + /// Gets or sets the VM SKU for database instance. + /// + [JsonProperty(PropertyName = "dbVmSku")] + public string DbVmSku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AppLocation == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AppLocation"); + } + if (Environment == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Environment"); + } + if (SapProduct == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SapProduct"); + } + if (DatabaseType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DatabaseType"); + } + if (DeploymentType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DeploymentType"); + } + if (DbVmSku == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DbVmSku"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDiskConfigurationsResult.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDiskConfigurationsResult.cs new file mode 100644 index 000000000000..277daff3bfb8 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPDiskConfigurationsResult.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list of disk configuration for vmSku which are part of SAP + /// deployment. + /// + public partial class SAPDiskConfigurationsResult + { + /// + /// Initializes a new instance of the SAPDiskConfigurationsResult + /// class. + /// + public SAPDiskConfigurationsResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPDiskConfigurationsResult + /// class. + /// + /// Gets the list of Disk + /// Configurations. + public SAPDiskConfigurationsResult(IList diskConfigurations = default(IList)) + { + DiskConfigurations = diskConfigurations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the list of Disk Configurations. + /// + [JsonProperty(PropertyName = "diskConfigurations")] + public IList DiskConfigurations { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPEnvironmentType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPEnvironmentType.cs new file mode 100644 index 000000000000..14bc003c4bd3 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPEnvironmentType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for SAPEnvironmentType. + /// + public static class SAPEnvironmentType + { + public const string NonProd = "NonProd"; + public const string Prod = "Prod"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPHealthState.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPHealthState.cs new file mode 100644 index 000000000000..77f78226aa73 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPHealthState.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for SAPHealthState. + /// + public static class SAPHealthState + { + public const string Unknown = "Unknown"; + public const string Healthy = "Healthy"; + public const string Unhealthy = "Unhealthy"; + public const string Degraded = "Degraded"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPHighAvailabilityType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPHighAvailabilityType.cs new file mode 100644 index 000000000000..89229975ed42 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPHighAvailabilityType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for SAPHighAvailabilityType. + /// + public static class SAPHighAvailabilityType + { + public const string AvailabilitySet = "AvailabilitySet"; + public const string AvailabilityZone = "AvailabilityZone"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPInstallWithoutOSConfigSoftwareConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPInstallWithoutOSConfigSoftwareConfiguration.cs new file mode 100644 index 000000000000..ddd9bf26b483 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPInstallWithoutOSConfigSoftwareConfiguration.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SAP Software configuration Input when the software is to be + /// installed by service without OS Configurations + /// + [Newtonsoft.Json.JsonObject("SAPInstallWithoutOSConfig")] + public partial class SAPInstallWithoutOSConfigSoftwareConfiguration : SoftwareConfiguration + { + /// + /// Initializes a new instance of the + /// SAPInstallWithoutOSConfigSoftwareConfiguration class. + /// + public SAPInstallWithoutOSConfigSoftwareConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SAPInstallWithoutOSConfigSoftwareConfiguration class. + /// + /// The URL to the SAP Build of Materials(BOM) + /// file. + /// The SAP bits storage account + /// id. + /// The software version to + /// install. + public SAPInstallWithoutOSConfigSoftwareConfiguration(string bomUrl, string sapBitsStorageAccountId, string softwareVersion, HighAvailabilitySoftwareConfiguration highAvailabilitySoftwareConfiguration = default(HighAvailabilitySoftwareConfiguration)) + { + BomUrl = bomUrl; + SapBitsStorageAccountId = sapBitsStorageAccountId; + SoftwareVersion = softwareVersion; + HighAvailabilitySoftwareConfiguration = highAvailabilitySoftwareConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL to the SAP Build of Materials(BOM) file. + /// + [JsonProperty(PropertyName = "bomUrl")] + public string BomUrl { get; set; } + + /// + /// Gets or sets the SAP bits storage account id. + /// + [JsonProperty(PropertyName = "sapBitsStorageAccountId")] + public string SapBitsStorageAccountId { get; set; } + + /// + /// Gets or sets the software version to install. + /// + [JsonProperty(PropertyName = "softwareVersion")] + public string SoftwareVersion { get; set; } + + /// + /// + [JsonProperty(PropertyName = "highAvailabilitySoftwareConfiguration")] + public HighAvailabilitySoftwareConfiguration HighAvailabilitySoftwareConfiguration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (BomUrl == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BomUrl"); + } + if (SapBitsStorageAccountId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SapBitsStorageAccountId"); + } + if (SoftwareVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SoftwareVersion"); + } + if (HighAvailabilitySoftwareConfiguration != null) + { + HighAvailabilitySoftwareConfiguration.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPProductType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPProductType.cs new file mode 100644 index 000000000000..ffbbc0de990c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPProductType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for SAPProductType. + /// + public static class SAPProductType + { + public const string ECC = "ECC"; + public const string S4HANA = "S4HANA"; + public const string Other = "Other"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSizingRecommendationRequest.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSizingRecommendationRequest.cs new file mode 100644 index 000000000000..f3e3c83489cd --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSizingRecommendationRequest.cs @@ -0,0 +1,161 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SAP Sizing Recommendation request. + /// + public partial class SAPSizingRecommendationRequest + { + /// + /// Initializes a new instance of the SAPSizingRecommendationRequest + /// class. + /// + public SAPSizingRecommendationRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPSizingRecommendationRequest + /// class. + /// + /// The geo-location where the resource is to + /// be created. + /// Possible values include: 'NonProd', + /// 'Prod' + /// Possible values include: 'ECC', 'S4HANA', + /// 'Other' + /// The deployment type. Eg: + /// SingleServer/ThreeTier. Possible values include: 'SingleServer', + /// 'ThreeTier' + /// The SAP Application Performance Standard + /// measurement. + /// The database memory configuration. + /// The database type. Possible values + /// include: 'HANA', 'DB2' + /// The DB scale method. Possible values + /// include: 'ScaleUp' + /// The high availability type. + /// Possible values include: 'AvailabilitySet', + /// 'AvailabilityZone' + public SAPSizingRecommendationRequest(string appLocation, string environment, string sapProduct, string deploymentType, long saps, long dbMemory, string databaseType, string dbScaleMethod = default(string), string highAvailabilityType = default(string)) + { + AppLocation = appLocation; + Environment = environment; + SapProduct = sapProduct; + DeploymentType = deploymentType; + Saps = saps; + DbMemory = dbMemory; + DatabaseType = databaseType; + DbScaleMethod = dbScaleMethod; + HighAvailabilityType = highAvailabilityType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the geo-location where the resource is to be created. + /// + [JsonProperty(PropertyName = "appLocation")] + public string AppLocation { get; set; } + + /// + /// Gets or sets possible values include: 'NonProd', 'Prod' + /// + [JsonProperty(PropertyName = "environment")] + public string Environment { get; set; } + + /// + /// Gets or sets possible values include: 'ECC', 'S4HANA', 'Other' + /// + [JsonProperty(PropertyName = "sapProduct")] + public string SapProduct { get; set; } + + /// + /// Gets or sets the deployment type. Eg: SingleServer/ThreeTier. + /// Possible values include: 'SingleServer', 'ThreeTier' + /// + [JsonProperty(PropertyName = "deploymentType")] + public string DeploymentType { get; set; } + + /// + /// Gets or sets the SAP Application Performance Standard measurement. + /// + [JsonProperty(PropertyName = "saps")] + public long Saps { get; set; } + + /// + /// Gets or sets the database memory configuration. + /// + [JsonProperty(PropertyName = "dbMemory")] + public long DbMemory { get; set; } + + /// + /// Gets or sets the database type. Possible values include: 'HANA', + /// 'DB2' + /// + [JsonProperty(PropertyName = "databaseType")] + public string DatabaseType { get; set; } + + /// + /// Gets or sets the DB scale method. Possible values include: + /// 'ScaleUp' + /// + [JsonProperty(PropertyName = "dbScaleMethod")] + public string DbScaleMethod { get; set; } + + /// + /// Gets or sets the high availability type. Possible values include: + /// 'AvailabilitySet', 'AvailabilityZone' + /// + [JsonProperty(PropertyName = "highAvailabilityType")] + public string HighAvailabilityType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AppLocation == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AppLocation"); + } + if (Environment == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Environment"); + } + if (SapProduct == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SapProduct"); + } + if (DeploymentType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DeploymentType"); + } + if (DatabaseType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DatabaseType"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSizingRecommendationResult.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSizingRecommendationResult.cs new file mode 100644 index 000000000000..e803bca826bb --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSizingRecommendationResult.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using System.Linq; + + /// + /// The SAP sizing recommendation result. + /// + public partial class SAPSizingRecommendationResult + { + /// + /// Initializes a new instance of the SAPSizingRecommendationResult + /// class. + /// + public SAPSizingRecommendationResult() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSoftwareInstallationType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSoftwareInstallationType.cs new file mode 100644 index 000000000000..999dda835d73 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSoftwareInstallationType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for SAPSoftwareInstallationType. + /// + public static class SAPSoftwareInstallationType + { + public const string ServiceInitiated = "ServiceInitiated"; + public const string SAPInstallWithoutOSConfig = "SAPInstallWithoutOSConfig"; + public const string External = "External"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSupportedResourceSkusResult.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSupportedResourceSkusResult.cs new file mode 100644 index 000000000000..57fe851cb114 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSupportedResourceSkusResult.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list of supported SKUs for different resources which are part of + /// SAP deployment. + /// + public partial class SAPSupportedResourceSkusResult + { + /// + /// Initializes a new instance of the SAPSupportedResourceSkusResult + /// class. + /// + public SAPSupportedResourceSkusResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPSupportedResourceSkusResult + /// class. + /// + /// Gets the list of SAP supported + /// SKUs. + public SAPSupportedResourceSkusResult(IList supportedSkus = default(IList)) + { + SupportedSkus = supportedSkus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the list of SAP supported SKUs. + /// + [JsonProperty(PropertyName = "supportedSkus")] + public IList SupportedSkus { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSupportedSku.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSupportedSku.cs new file mode 100644 index 000000000000..9df8fc5f8a0d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSupportedSku.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SAP supported SKU. + /// + public partial class SAPSupportedSku + { + /// + /// Initializes a new instance of the SAPSupportedSku class. + /// + public SAPSupportedSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPSupportedSku class. + /// + /// The VM Sku. + /// True if the Sku is certified for + /// App server in the SAP system. + /// True if the Sku is certified for + /// Database server in the SAP system. + public SAPSupportedSku(string vmSku = default(string), bool? isAppServerCertified = default(bool?), bool? isDatabaseCertified = default(bool?)) + { + VmSku = vmSku; + IsAppServerCertified = isAppServerCertified; + IsDatabaseCertified = isDatabaseCertified; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the VM Sku. + /// + [JsonProperty(PropertyName = "vmSku")] + public string VmSku { get; set; } + + /// + /// Gets or sets true if the Sku is certified for App server in the SAP + /// system. + /// + [JsonProperty(PropertyName = "isAppServerCertified")] + public bool? IsAppServerCertified { get; set; } + + /// + /// Gets or sets true if the Sku is certified for Database server in + /// the SAP system. + /// + [JsonProperty(PropertyName = "isDatabaseCertified")] + public bool? IsDatabaseCertified { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSupportedSkusRequest.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSupportedSkusRequest.cs new file mode 100644 index 000000000000..2c6fc2d01eda --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPSupportedSkusRequest.cs @@ -0,0 +1,132 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SAP request to get list of supported SKUs. + /// + public partial class SAPSupportedSkusRequest + { + /// + /// Initializes a new instance of the SAPSupportedSkusRequest class. + /// + public SAPSupportedSkusRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPSupportedSkusRequest class. + /// + /// The geo-location where the resource is to + /// be created. + /// Possible values include: 'NonProd', + /// 'Prod' + /// Possible values include: 'ECC', 'S4HANA', + /// 'Other' + /// The deployment type. Eg: + /// SingleServer/ThreeTier. Possible values include: 'SingleServer', + /// 'ThreeTier' + /// The database type. Eg: HANA, DB2, etc. + /// Possible values include: 'HANA', 'DB2' + /// The high availability type. + /// Possible values include: 'AvailabilitySet', + /// 'AvailabilityZone' + public SAPSupportedSkusRequest(string appLocation, string environment, string sapProduct, string deploymentType, string databaseType, string highAvailabilityType = default(string)) + { + AppLocation = appLocation; + Environment = environment; + SapProduct = sapProduct; + DeploymentType = deploymentType; + DatabaseType = databaseType; + HighAvailabilityType = highAvailabilityType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the geo-location where the resource is to be created. + /// + [JsonProperty(PropertyName = "appLocation")] + public string AppLocation { get; set; } + + /// + /// Gets or sets possible values include: 'NonProd', 'Prod' + /// + [JsonProperty(PropertyName = "environment")] + public string Environment { get; set; } + + /// + /// Gets or sets possible values include: 'ECC', 'S4HANA', 'Other' + /// + [JsonProperty(PropertyName = "sapProduct")] + public string SapProduct { get; set; } + + /// + /// Gets or sets the deployment type. Eg: SingleServer/ThreeTier. + /// Possible values include: 'SingleServer', 'ThreeTier' + /// + [JsonProperty(PropertyName = "deploymentType")] + public string DeploymentType { get; set; } + + /// + /// Gets or sets the database type. Eg: HANA, DB2, etc. Possible values + /// include: 'HANA', 'DB2' + /// + [JsonProperty(PropertyName = "databaseType")] + public string DatabaseType { get; set; } + + /// + /// Gets or sets the high availability type. Possible values include: + /// 'AvailabilitySet', 'AvailabilityZone' + /// + [JsonProperty(PropertyName = "highAvailabilityType")] + public string HighAvailabilityType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AppLocation == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AppLocation"); + } + if (Environment == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Environment"); + } + if (SapProduct == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SapProduct"); + } + if (DeploymentType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DeploymentType"); + } + if (DatabaseType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DatabaseType"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPVirtualInstance.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPVirtualInstance.cs new file mode 100644 index 000000000000..9a82f1e0f267 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPVirtualInstance.cs @@ -0,0 +1,193 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Define the Virtual Instance for SAP solutions resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class SAPVirtualInstance : TrackedResource + { + /// + /// Initializes a new instance of the SAPVirtualInstance class. + /// + public SAPVirtualInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPVirtualInstance class. + /// + /// The geo-location where the resource + /// lives + /// Possible values include: 'NonProd', + /// 'Prod' + /// Possible values include: 'ECC', 'S4HANA', + /// 'Other' + /// Defines if the SAP system is being + /// created using Azure Center for SAP solutions (ACSS) or if an + /// existing SAP system is being registered with ACSS + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// Managed resource + /// group configuration + /// Possible values include: 'Starting', + /// 'Running', 'Stopping', 'Offline', 'PartiallyRunning', + /// 'Unavailable' + /// Possible values include: 'Unknown', 'Healthy', + /// 'Unhealthy', 'Degraded' + /// Possible values include: + /// 'InfrastructureDeploymentPending', + /// 'InfrastructureDeploymentInProgress', + /// 'InfrastructureDeploymentFailed', 'SoftwareInstallationPending', + /// 'SoftwareInstallationInProgress', 'SoftwareInstallationFailed', + /// 'SoftwareDetectionInProgress', 'SoftwareDetectionFailed', + /// 'DiscoveryPending', 'DiscoveryInProgress', 'DiscoveryFailed', + /// 'RegistrationComplete' + /// Possible values include: + /// 'Succeeded', 'Updating', 'Creating', 'Failed', 'Deleting' + /// Indicates any errors on the Virtual Instance + /// for SAP solutions resource. + public SAPVirtualInstance(string location, string environment, string sapProduct, SAPConfiguration configuration, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), UserAssignedServiceIdentity identity = default(UserAssignedServiceIdentity), ManagedRGConfiguration managedResourceGroupConfiguration = default(ManagedRGConfiguration), string status = default(string), string health = default(string), string state = default(string), string provisioningState = default(string), SAPVirtualInstanceError errors = default(SAPVirtualInstanceError)) + : base(location, id, name, type, systemData, tags) + { + Identity = identity; + Environment = environment; + SapProduct = sapProduct; + Configuration = configuration; + ManagedResourceGroupConfiguration = managedResourceGroupConfiguration; + Status = status; + Health = health; + State = state; + ProvisioningState = provisioningState; + Errors = errors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "identity")] + public UserAssignedServiceIdentity Identity { get; set; } + + /// + /// Gets or sets possible values include: 'NonProd', 'Prod' + /// + [JsonProperty(PropertyName = "properties.environment")] + public string Environment { get; set; } + + /// + /// Gets or sets possible values include: 'ECC', 'S4HANA', 'Other' + /// + [JsonProperty(PropertyName = "properties.sapProduct")] + public string SapProduct { get; set; } + + /// + /// Gets or sets defines if the SAP system is being created using Azure + /// Center for SAP solutions (ACSS) or if an existing SAP system is + /// being registered with ACSS + /// + [JsonProperty(PropertyName = "properties.configuration")] + public SAPConfiguration Configuration { get; set; } + + /// + /// Gets or sets managed resource group configuration + /// + [JsonProperty(PropertyName = "properties.managedResourceGroupConfiguration")] + public ManagedRGConfiguration ManagedResourceGroupConfiguration { get; set; } + + /// + /// Gets possible values include: 'Starting', 'Running', 'Stopping', + /// 'Offline', 'PartiallyRunning', 'Unavailable' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets possible values include: 'Unknown', 'Healthy', 'Unhealthy', + /// 'Degraded' + /// + [JsonProperty(PropertyName = "properties.health")] + public string Health { get; private set; } + + /// + /// Gets possible values include: 'InfrastructureDeploymentPending', + /// 'InfrastructureDeploymentInProgress', + /// 'InfrastructureDeploymentFailed', 'SoftwareInstallationPending', + /// 'SoftwareInstallationInProgress', 'SoftwareInstallationFailed', + /// 'SoftwareDetectionInProgress', 'SoftwareDetectionFailed', + /// 'DiscoveryPending', 'DiscoveryInProgress', 'DiscoveryFailed', + /// 'RegistrationComplete' + /// + [JsonProperty(PropertyName = "properties.state")] + public string State { get; private set; } + + /// + /// Gets possible values include: 'Succeeded', 'Updating', 'Creating', + /// 'Failed', 'Deleting' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets indicates any errors on the Virtual Instance for SAP solutions + /// resource. + /// + [JsonProperty(PropertyName = "properties.errors")] + public SAPVirtualInstanceError Errors { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Environment == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Environment"); + } + if (SapProduct == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SapProduct"); + } + if (Configuration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Configuration"); + } + if (Identity != null) + { + Identity.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPVirtualInstanceError.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPVirtualInstanceError.cs new file mode 100644 index 000000000000..99492fa47d88 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPVirtualInstanceError.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An error response from the Virtual Instance for SAP Workload service. + /// + public partial class SAPVirtualInstanceError + { + /// + /// Initializes a new instance of the SAPVirtualInstanceError class. + /// + public SAPVirtualInstanceError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPVirtualInstanceError class. + /// + /// The Virtual Instance for SAP error + /// body. + public SAPVirtualInstanceError(ErrorDefinition properties = default(ErrorDefinition)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Virtual Instance for SAP error body. + /// + [JsonProperty(PropertyName = "properties")] + public ErrorDefinition Properties { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPVirtualInstanceState.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPVirtualInstanceState.cs new file mode 100644 index 000000000000..b22a1bd3d22c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPVirtualInstanceState.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for SAPVirtualInstanceState. + /// + public static class SAPVirtualInstanceState + { + public const string InfrastructureDeploymentPending = "InfrastructureDeploymentPending"; + public const string InfrastructureDeploymentInProgress = "InfrastructureDeploymentInProgress"; + public const string InfrastructureDeploymentFailed = "InfrastructureDeploymentFailed"; + public const string SoftwareInstallationPending = "SoftwareInstallationPending"; + public const string SoftwareInstallationInProgress = "SoftwareInstallationInProgress"; + public const string SoftwareInstallationFailed = "SoftwareInstallationFailed"; + public const string SoftwareDetectionInProgress = "SoftwareDetectionInProgress"; + public const string SoftwareDetectionFailed = "SoftwareDetectionFailed"; + public const string DiscoveryPending = "DiscoveryPending"; + public const string DiscoveryInProgress = "DiscoveryInProgress"; + public const string DiscoveryFailed = "DiscoveryFailed"; + public const string RegistrationComplete = "RegistrationComplete"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPVirtualInstanceStatus.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPVirtualInstanceStatus.cs new file mode 100644 index 000000000000..1a89fb15ebea --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SAPVirtualInstanceStatus.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for SAPVirtualInstanceStatus. + /// + public static class SAPVirtualInstanceStatus + { + public const string Starting = "Starting"; + public const string Running = "Running"; + public const string Stopping = "Stopping"; + public const string Offline = "Offline"; + public const string PartiallyRunning = "PartiallyRunning"; + public const string Unavailable = "Unavailable"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SapNetWeaverProviderInstanceProperties.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SapNetWeaverProviderInstanceProperties.cs new file mode 100644 index 000000000000..8067bf469ab6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SapNetWeaverProviderInstanceProperties.cs @@ -0,0 +1,134 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Gets or sets the provider properties. + /// + [Newtonsoft.Json.JsonObject("SapNetWeaver")] + public partial class SapNetWeaverProviderInstanceProperties : ProviderSpecificProperties + { + /// + /// Initializes a new instance of the + /// SapNetWeaverProviderInstanceProperties class. + /// + public SapNetWeaverProviderInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SapNetWeaverProviderInstanceProperties class. + /// + /// Gets or sets the SAP System Identifier + /// Gets or sets the target virtual machine + /// IP Address/FQDN. + /// Gets or sets the instance number of SAP + /// NetWeaver. + /// Gets or sets the list of HostFile + /// Entries + /// Gets or sets the SAP user name. + /// Sets the SAP password. + /// Gets or sets the key vault URI to + /// secret with the SAP password. + /// Gets or sets the SAP Client ID. + /// Gets or sets the SAP HTTP port + /// number. + /// Gets or sets the blob URI to SSL + /// certificate for the SAP system. + public SapNetWeaverProviderInstanceProperties(string sapSid = default(string), string sapHostname = default(string), string sapInstanceNr = default(string), IList sapHostFileEntries = default(IList), string sapUsername = default(string), string sapPassword = default(string), string sapPasswordUri = default(string), string sapClientId = default(string), string sapPortNumber = default(string), string sapSslCertificateUri = default(string)) + { + SapSid = sapSid; + SapHostname = sapHostname; + SapInstanceNr = sapInstanceNr; + SapHostFileEntries = sapHostFileEntries; + SapUsername = sapUsername; + SapPassword = sapPassword; + SapPasswordUri = sapPasswordUri; + SapClientId = sapClientId; + SapPortNumber = sapPortNumber; + SapSslCertificateUri = sapSslCertificateUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the SAP System Identifier + /// + [JsonProperty(PropertyName = "sapSid")] + public string SapSid { get; set; } + + /// + /// Gets or sets the target virtual machine IP Address/FQDN. + /// + [JsonProperty(PropertyName = "sapHostname")] + public string SapHostname { get; set; } + + /// + /// Gets or sets the instance number of SAP NetWeaver. + /// + [JsonProperty(PropertyName = "sapInstanceNr")] + public string SapInstanceNr { get; set; } + + /// + /// Gets or sets the list of HostFile Entries + /// + [JsonProperty(PropertyName = "sapHostFileEntries")] + public IList SapHostFileEntries { get; set; } + + /// + /// Gets or sets the SAP user name. + /// + [JsonProperty(PropertyName = "sapUsername")] + public string SapUsername { get; set; } + + /// + /// Gets or sets sets the SAP password. + /// + [JsonProperty(PropertyName = "sapPassword")] + public string SapPassword { get; set; } + + /// + /// Gets or sets the key vault URI to secret with the SAP password. + /// + [JsonProperty(PropertyName = "sapPasswordUri")] + public string SapPasswordUri { get; set; } + + /// + /// Gets or sets the SAP Client ID. + /// + [JsonProperty(PropertyName = "sapClientId")] + public string SapClientId { get; set; } + + /// + /// Gets or sets the SAP HTTP port number. + /// + [JsonProperty(PropertyName = "sapPortNumber")] + public string SapPortNumber { get; set; } + + /// + /// Gets or sets the blob URI to SSL certificate for the SAP system. + /// + [JsonProperty(PropertyName = "sapSslCertificateUri")] + public string SapSslCertificateUri { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SapVirtualInstanceProvisioningState.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SapVirtualInstanceProvisioningState.cs new file mode 100644 index 000000000000..88225ad24b6b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SapVirtualInstanceProvisioningState.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for SapVirtualInstanceProvisioningState. + /// + public static class SapVirtualInstanceProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Updating = "Updating"; + public const string Creating = "Creating"; + public const string Failed = "Failed"; + public const string Deleting = "Deleting"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SearchProfile.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SearchProfile.cs new file mode 100644 index 000000000000..684b15de5c20 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SearchProfile.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Search profile + /// + public partial class SearchProfile : NodeProfile + { + /// + /// Initializes a new instance of the SearchProfile class. + /// + public SearchProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SearchProfile class. + /// + /// VM SKU for node(s) + /// OS image used for creating the nodes + /// OS disk details + /// VM or VMSS name + /// Data disks details. This property is not in + /// use right now + /// VM/VMSS resource ARM Ids + public SearchProfile(string nodeSku, OsImageProfile osImage, DiskInfo osDisk, string name = default(string), IList dataDisks = default(IList), IList nodeResourceIds = default(IList)) + : base(nodeSku, osImage, osDisk, name, dataDisks, nodeResourceIds) + { + CustomInit(); + } + /// + /// Static constructor for SearchProfile class. + /// + static SearchProfile() + { + SearchType = "Elastic"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Search type + /// + [JsonProperty(PropertyName = "searchType")] + public static string SearchType { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ServiceInitiatedSoftwareConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ServiceInitiatedSoftwareConfiguration.cs new file mode 100644 index 000000000000..bb331ba97465 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ServiceInitiatedSoftwareConfiguration.cs @@ -0,0 +1,131 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SAP Software configuration Input when the software is to be + /// installed by service. + /// + [Newtonsoft.Json.JsonObject("ServiceInitiated")] + public partial class ServiceInitiatedSoftwareConfiguration : SoftwareConfiguration + { + /// + /// Initializes a new instance of the + /// ServiceInitiatedSoftwareConfiguration class. + /// + public ServiceInitiatedSoftwareConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ServiceInitiatedSoftwareConfiguration class. + /// + /// The URL to the SAP Build of Materials(BOM) + /// file. + /// The software version to + /// install. + /// The SAP bits storage account + /// id. + /// The FQDN to set for the SAP system during + /// install. + /// The SSH private key. + public ServiceInitiatedSoftwareConfiguration(string bomUrl, string softwareVersion, string sapBitsStorageAccountId, string sapFqdn, string sshPrivateKey, HighAvailabilitySoftwareConfiguration highAvailabilitySoftwareConfiguration = default(HighAvailabilitySoftwareConfiguration)) + { + BomUrl = bomUrl; + SoftwareVersion = softwareVersion; + SapBitsStorageAccountId = sapBitsStorageAccountId; + SapFqdn = sapFqdn; + SshPrivateKey = sshPrivateKey; + HighAvailabilitySoftwareConfiguration = highAvailabilitySoftwareConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL to the SAP Build of Materials(BOM) file. + /// + [JsonProperty(PropertyName = "bomUrl")] + public string BomUrl { get; set; } + + /// + /// Gets or sets the software version to install. + /// + [JsonProperty(PropertyName = "softwareVersion")] + public string SoftwareVersion { get; set; } + + /// + /// Gets or sets the SAP bits storage account id. + /// + [JsonProperty(PropertyName = "sapBitsStorageAccountId")] + public string SapBitsStorageAccountId { get; set; } + + /// + /// Gets or sets the FQDN to set for the SAP system during install. + /// + [JsonProperty(PropertyName = "sapFqdn")] + public string SapFqdn { get; set; } + + /// + /// Gets or sets the SSH private key. + /// + [JsonProperty(PropertyName = "sshPrivateKey")] + public string SshPrivateKey { get; set; } + + /// + /// + [JsonProperty(PropertyName = "highAvailabilitySoftwareConfiguration")] + public HighAvailabilitySoftwareConfiguration HighAvailabilitySoftwareConfiguration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (BomUrl == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BomUrl"); + } + if (SoftwareVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SoftwareVersion"); + } + if (SapBitsStorageAccountId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SapBitsStorageAccountId"); + } + if (SapFqdn == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SapFqdn"); + } + if (SshPrivateKey == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SshPrivateKey"); + } + if (HighAvailabilitySoftwareConfiguration != null) + { + HighAvailabilitySoftwareConfiguration.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SingleServerConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SingleServerConfiguration.cs new file mode 100644 index 000000000000..0953de9f7f1c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SingleServerConfiguration.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the single server configuration. + /// + [Newtonsoft.Json.JsonObject("SingleServer")] + public partial class SingleServerConfiguration : InfrastructureConfiguration + { + /// + /// Initializes a new instance of the SingleServerConfiguration class. + /// + public SingleServerConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SingleServerConfiguration class. + /// + /// The application resource group where + /// SAP system resources will be deployed. + /// The subnet id. + /// Gets or sets the virtual + /// machine configuration. + /// Network configuration for the + /// server + /// The database type. Possible values + /// include: 'HANA', 'DB2' + public SingleServerConfiguration(string appResourceGroup, string subnetId, VirtualMachineConfiguration virtualMachineConfiguration, NetworkConfiguration networkConfiguration = default(NetworkConfiguration), string databaseType = default(string)) + : base(appResourceGroup) + { + NetworkConfiguration = networkConfiguration; + DatabaseType = databaseType; + SubnetId = subnetId; + VirtualMachineConfiguration = virtualMachineConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets network configuration for the server + /// + [JsonProperty(PropertyName = "networkConfiguration")] + public NetworkConfiguration NetworkConfiguration { get; set; } + + /// + /// Gets or sets the database type. Possible values include: 'HANA', + /// 'DB2' + /// + [JsonProperty(PropertyName = "databaseType")] + public string DatabaseType { get; set; } + + /// + /// Gets or sets the subnet id. + /// + [JsonProperty(PropertyName = "subnetId")] + public string SubnetId { get; set; } + + /// + /// Gets or sets the virtual machine configuration. + /// + [JsonProperty(PropertyName = "virtualMachineConfiguration")] + public VirtualMachineConfiguration VirtualMachineConfiguration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (SubnetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SubnetId"); + } + if (VirtualMachineConfiguration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VirtualMachineConfiguration"); + } + if (VirtualMachineConfiguration != null) + { + VirtualMachineConfiguration.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SingleServerRecommendationResult.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SingleServerRecommendationResult.cs new file mode 100644 index 000000000000..51ebcab7dc28 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SingleServerRecommendationResult.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The recommended configuration for a single server SAP system. + /// + [Newtonsoft.Json.JsonObject("SingleServer")] + public partial class SingleServerRecommendationResult : SAPSizingRecommendationResult + { + /// + /// Initializes a new instance of the SingleServerRecommendationResult + /// class. + /// + public SingleServerRecommendationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SingleServerRecommendationResult + /// class. + /// + /// The recommended VM SKU for single + /// server. + public SingleServerRecommendationResult(string vmSku = default(string)) + { + VmSku = vmSku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the recommended VM SKU for single server. + /// + [JsonProperty(PropertyName = "vmSku")] + public string VmSku { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SiteProfile.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SiteProfile.cs new file mode 100644 index 000000000000..c47fae4260ff --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SiteProfile.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Workload website profile + /// + public partial class SiteProfile + { + /// + /// Initializes a new instance of the SiteProfile class. + /// + public SiteProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SiteProfile class. + /// + /// Domain name for the application site + /// URL + public SiteProfile(string domainName = default(string)) + { + DomainName = domainName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets domain name for the application site URL + /// + [JsonProperty(PropertyName = "domainName")] + public string DomainName { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Sku.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Sku.cs new file mode 100644 index 000000000000..e082ac468d41 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Sku.cs @@ -0,0 +1,110 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource model definition representing SKU + /// + public partial class Sku + { + /// + /// Initializes a new instance of the Sku class. + /// + public Sku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Sku class. + /// + /// The name of the SKU. Ex - P3. It is typically a + /// letter+number code + /// Possible values include: 'Free', 'Basic', + /// 'Standard', 'Premium' + /// The SKU size. When the name field is the + /// combination of tier and some other value, this would be the + /// standalone code. + /// If the service has different generations of + /// hardware, for the same SKU, then that can be captured here. + /// If the SKU supports scale out/in then the + /// capacity integer should be included. If scale out/in is not + /// possible for the resource this may be omitted. + public Sku(string name, SkuTier? tier = default(SkuTier?), string size = default(string), string family = default(string), int? capacity = default(int?)) + { + Name = name; + Tier = tier; + Size = size; + Family = family; + Capacity = capacity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the SKU. Ex - P3. It is typically a + /// letter+number code + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets possible values include: 'Free', 'Basic', 'Standard', + /// 'Premium' + /// + [JsonProperty(PropertyName = "tier")] + public SkuTier? Tier { get; set; } + + /// + /// Gets or sets the SKU size. When the name field is the combination + /// of tier and some other value, this would be the standalone code. + /// + [JsonProperty(PropertyName = "size")] + public string Size { get; set; } + + /// + /// Gets or sets if the service has different generations of hardware, + /// for the same SKU, then that can be captured here. + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; set; } + + /// + /// Gets or sets if the SKU supports scale out/in then the capacity + /// integer should be included. If scale out/in is not possible for the + /// resource this may be omitted. + /// + [JsonProperty(PropertyName = "capacity")] + public int? Capacity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuCapability.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuCapability.cs new file mode 100644 index 000000000000..881e3b619570 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuCapability.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SKU capability definition. + /// + public partial class SkuCapability + { + /// + /// Initializes a new instance of the SkuCapability class. + /// + public SkuCapability() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuCapability class. + /// + /// The capability name. + /// The capability value. + public SkuCapability(string name = default(string), string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the capability name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the capability value. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuCapacity.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuCapacity.cs new file mode 100644 index 000000000000..4a2c6a91f276 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuCapacity.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SKU capacity. + /// + public partial class SkuCapacity + { + /// + /// Initializes a new instance of the SkuCapacity class. + /// + public SkuCapacity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuCapacity class. + /// + /// Minimum capacity value. + /// Maximum capacity value. + /// Default capacity value. + /// Scale type of the SKU capacity. Possible + /// values include: 'None', 'Manual', 'Automatic' + public SkuCapacity(int? minimum = default(int?), int? maximum = default(int?), int? defaultProperty = default(int?), string scaleType = default(string)) + { + Minimum = minimum; + Maximum = maximum; + DefaultProperty = defaultProperty; + ScaleType = scaleType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets minimum capacity value. + /// + [JsonProperty(PropertyName = "minimum")] + public int? Minimum { get; set; } + + /// + /// Gets or sets maximum capacity value. + /// + [JsonProperty(PropertyName = "maximum")] + public int? Maximum { get; set; } + + /// + /// Gets or sets default capacity value. + /// + [JsonProperty(PropertyName = "default")] + public int? DefaultProperty { get; set; } + + /// + /// Gets or sets scale type of the SKU capacity. Possible values + /// include: 'None', 'Manual', 'Automatic' + /// + [JsonProperty(PropertyName = "scaleType")] + public string ScaleType { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuCost.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuCost.cs new file mode 100644 index 000000000000..a8c6ad6202d7 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuCost.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SKU cost definition. + /// + public partial class SkuCost + { + /// + /// Initializes a new instance of the SkuCost class. + /// + public SkuCost() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuCost class. + /// + /// Billing meter id. + /// The quantity. + /// The extended unit. + public SkuCost(string meterId = default(string), int? quantity = default(int?), string extendedUnit = default(string)) + { + MeterId = meterId; + Quantity = quantity; + ExtendedUnit = extendedUnit; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets billing meter id. + /// + [JsonProperty(PropertyName = "meterId")] + public string MeterId { get; set; } + + /// + /// Gets or sets the quantity. + /// + [JsonProperty(PropertyName = "quantity")] + public int? Quantity { get; set; } + + /// + /// Gets or sets the extended unit. + /// + [JsonProperty(PropertyName = "extendedUnit")] + public string ExtendedUnit { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuDefinition.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuDefinition.cs new file mode 100644 index 000000000000..8e9f55c13311 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuDefinition.cs @@ -0,0 +1,173 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The SKU definition. + /// + public partial class SkuDefinition + { + /// + /// Initializes a new instance of the SkuDefinition class. + /// + public SkuDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuDefinition class. + /// + /// The name of the SKU. + /// Resource type the SKU applicable + /// for. + /// This field is required to be implemented by the + /// Resource Provider if the service has more than one tier, but is not + /// required on a PUT. + /// The SKU size. When the name field is the + /// combination of tier and some other value, this would be the + /// standalone code. + /// If the service has different generations of + /// hardware, for the same SKU, then that can be captured here. + /// If the service has different kinds of hardware, + /// for the same SKU, then that can be captured here. + /// List of locations where this SKU is + /// available. + /// List of locations where this SKU is + /// available. + /// If the SKU supports scale out/in then the + /// capacity integer should be included. If scale out/in is not + /// possible for the resource this may be omitted. + /// The SKU costs. + /// The SKU capabilities. + /// The SKU restrictions. + public SkuDefinition(string name, string resourceType = default(string), string tier = default(string), string size = default(string), string family = default(string), string kind = default(string), IList locations = default(IList), IList locationInfo = default(IList), object capacity = default(object), IList costs = default(IList), IList capabilities = default(IList), IList restrictions = default(IList)) + { + Name = name; + ResourceType = resourceType; + Tier = tier; + Size = size; + Family = family; + Kind = kind; + Locations = locations; + LocationInfo = locationInfo; + Capacity = capacity; + Costs = costs; + Capabilities = capabilities; + Restrictions = restrictions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the SKU. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets resource type the SKU applicable for. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; set; } + + /// + /// Gets or sets this field is required to be implemented by the + /// Resource Provider if the service has more than one tier, but is not + /// required on a PUT. + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; set; } + + /// + /// Gets or sets the SKU size. When the name field is the combination + /// of tier and some other value, this would be the standalone code. + /// + [JsonProperty(PropertyName = "size")] + public string Size { get; set; } + + /// + /// Gets or sets if the service has different generations of hardware, + /// for the same SKU, then that can be captured here. + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; set; } + + /// + /// Gets or sets if the service has different kinds of hardware, for + /// the same SKU, then that can be captured here. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets list of locations where this SKU is available. + /// + [JsonProperty(PropertyName = "locations")] + public IList Locations { get; set; } + + /// + /// Gets or sets list of locations where this SKU is available. + /// + [JsonProperty(PropertyName = "locationInfo")] + public IList LocationInfo { get; set; } + + /// + /// Gets or sets if the SKU supports scale out/in then the capacity + /// integer should be included. If scale out/in is not possible for the + /// resource this may be omitted. + /// + [JsonProperty(PropertyName = "capacity")] + public object Capacity { get; set; } + + /// + /// Gets or sets the SKU costs. + /// + [JsonProperty(PropertyName = "costs")] + public IList Costs { get; set; } + + /// + /// Gets or sets the SKU capabilities. + /// + [JsonProperty(PropertyName = "capabilities")] + public IList Capabilities { get; set; } + + /// + /// Gets or sets the SKU restrictions. + /// + [JsonProperty(PropertyName = "restrictions")] + public IList Restrictions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuLocationAndZones.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuLocationAndZones.cs new file mode 100644 index 000000000000..f1ecc760d315 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuLocationAndZones.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The SKU location and zone. + /// + public partial class SkuLocationAndZones + { + /// + /// Initializes a new instance of the SkuLocationAndZones class. + /// + public SkuLocationAndZones() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuLocationAndZones class. + /// + /// The location of the SKU. + /// The availability zones of SKU location. + /// The availability zone details of the SKU + /// location. + /// The extended locations of + /// SKU. + /// Type of the extended location. Possible values + /// include: 'Region', 'EdgeZone' + public SkuLocationAndZones(string location = default(string), IList zones = default(IList), IList zoneDetails = default(IList), IList extendedLocations = default(IList), string type = default(string)) + { + Location = location; + Zones = zones; + ZoneDetails = zoneDetails; + ExtendedLocations = extendedLocations; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the location of the SKU. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets the availability zones of SKU location. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Gets or sets the availability zone details of the SKU location. + /// + [JsonProperty(PropertyName = "zoneDetails")] + public IList ZoneDetails { get; set; } + + /// + /// Gets or sets the extended locations of SKU. + /// + [JsonProperty(PropertyName = "extendedLocations")] + public IList ExtendedLocations { get; set; } + + /// + /// Gets or sets type of the extended location. Possible values + /// include: 'Region', 'EdgeZone' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuRestriction.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuRestriction.cs new file mode 100644 index 000000000000..8744a7686189 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuRestriction.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The SKU restriction definition. + /// + public partial class SkuRestriction + { + /// + /// Initializes a new instance of the SkuRestriction class. + /// + public SkuRestriction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuRestriction class. + /// + /// The SKU restriction type. Possible values + /// include: 'NotSpecified', 'Location', 'Zone' + /// Restriction values. + /// The restriction information. + /// The SKU restriction reason code. Possible + /// values include: 'NotSpecified', 'QuotaId', + /// 'NotAvailableForSubscription' + public SkuRestriction(string type = default(string), IList values = default(IList), object restrictionInfo = default(object), string reasonCode = default(string)) + { + Type = type; + Values = values; + RestrictionInfo = restrictionInfo; + ReasonCode = reasonCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the SKU restriction type. Possible values include: + /// 'NotSpecified', 'Location', 'Zone' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets restriction values. + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; set; } + + /// + /// Gets or sets the restriction information. + /// + [JsonProperty(PropertyName = "restrictionInfo")] + public object RestrictionInfo { get; set; } + + /// + /// Gets or sets the SKU restriction reason code. Possible values + /// include: 'NotSpecified', 'QuotaId', 'NotAvailableForSubscription' + /// + [JsonProperty(PropertyName = "reasonCode")] + public string ReasonCode { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuRestrictionReasonCode.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuRestrictionReasonCode.cs new file mode 100644 index 000000000000..199a7e7410ca --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuRestrictionReasonCode.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for SkuRestrictionReasonCode. + /// + public static class SkuRestrictionReasonCode + { + public const string NotSpecified = "NotSpecified"; + public const string QuotaId = "QuotaId"; + public const string NotAvailableForSubscription = "NotAvailableForSubscription"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuRestrictionType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuRestrictionType.cs new file mode 100644 index 000000000000..17b7c64fb91c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuRestrictionType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for SkuRestrictionType. + /// + public static class SkuRestrictionType + { + public const string NotSpecified = "NotSpecified"; + public const string Location = "Location"; + public const string Zone = "Zone"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuScaleType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuScaleType.cs new file mode 100644 index 000000000000..c292d7610fda --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuScaleType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for SkuScaleType. + /// + public static class SkuScaleType + { + public const string None = "None"; + public const string Manual = "Manual"; + public const string Automatic = "Automatic"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuTier.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuTier.cs new file mode 100644 index 000000000000..5b5799dae748 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuTier.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SkuTier. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SkuTier + { + [EnumMember(Value = "Free")] + Free, + [EnumMember(Value = "Basic")] + Basic, + [EnumMember(Value = "Standard")] + Standard, + [EnumMember(Value = "Premium")] + Premium + } + internal static class SkuTierEnumExtension + { + internal static string ToSerializedValue(this SkuTier? value) + { + return value == null ? null : ((SkuTier)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SkuTier value) + { + switch( value ) + { + case SkuTier.Free: + return "Free"; + case SkuTier.Basic: + return "Basic"; + case SkuTier.Standard: + return "Standard"; + case SkuTier.Premium: + return "Premium"; + } + return null; + } + + internal static SkuTier? ParseSkuTier(this string value) + { + switch( value ) + { + case "Free": + return SkuTier.Free; + case "Basic": + return SkuTier.Basic; + case "Standard": + return SkuTier.Standard; + case "Premium": + return SkuTier.Premium; + } + return null; + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuZoneDetail.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuZoneDetail.cs new file mode 100644 index 000000000000..645dcc96b1cc --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SkuZoneDetail.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The SKU zone details. + /// + public partial class SkuZoneDetail + { + /// + /// Initializes a new instance of the SkuZoneDetail class. + /// + public SkuZoneDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuZoneDetail class. + /// + /// The physical zones. + /// The capabilities. + public SkuZoneDetail(IList zones = default(IList), IList capabilities = default(IList)) + { + Zones = zones; + Capabilities = capabilities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the physical zones. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Gets or sets the capabilities. + /// + [JsonProperty(PropertyName = "capabilities")] + public IList Capabilities { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SoftwareConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SoftwareConfiguration.cs new file mode 100644 index 000000000000..0187d8894355 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SoftwareConfiguration.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using System.Linq; + + /// + /// The SAP Software configuration Input. + /// + public partial class SoftwareConfiguration + { + /// + /// Initializes a new instance of the SoftwareConfiguration class. + /// + public SoftwareConfiguration() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SshConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SshConfiguration.cs new file mode 100644 index 000000000000..f181fe23282b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SshConfiguration.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// SSH configuration for Linux based VMs running on Azure + /// + public partial class SshConfiguration + { + /// + /// Initializes a new instance of the SshConfiguration class. + /// + public SshConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SshConfiguration class. + /// + /// The list of SSH public keys used to + /// authenticate with linux based VMs. + public SshConfiguration(IList publicKeys = default(IList)) + { + PublicKeys = publicKeys; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of SSH public keys used to authenticate with + /// linux based VMs. + /// + [JsonProperty(PropertyName = "publicKeys")] + public IList PublicKeys { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SshKeyPair.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SshKeyPair.cs new file mode 100644 index 000000000000..7a629dfc7e80 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SshKeyPair.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SSH Key-pair used to authenticate with the VM. The key needs to be + /// at least 2048-bit and in ssh-rsa format. <br><br> For + /// creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs + /// in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + /// + public partial class SshKeyPair + { + /// + /// Initializes a new instance of the SshKeyPair class. + /// + public SshKeyPair() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SshKeyPair class. + /// + /// SSH public key + /// SSH private key. + public SshKeyPair(string publicKey = default(string), string privateKey = default(string)) + { + PublicKey = publicKey; + PrivateKey = privateKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets SSH public key + /// + [JsonProperty(PropertyName = "publicKey")] + public string PublicKey { get; set; } + + /// + /// Gets or sets SSH private key. + /// + [JsonProperty(PropertyName = "privateKey")] + public string PrivateKey { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SshPublicKey.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SshPublicKey.cs new file mode 100644 index 000000000000..295fcf98287a --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SshPublicKey.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains information about SSH certificate public key and the path on + /// the Linux VM where the public key is placed. + /// + public partial class SshPublicKey + { + /// + /// Initializes a new instance of the SshPublicKey class. + /// + public SshPublicKey() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SshPublicKey class. + /// + /// SSH public key certificate used to + /// authenticate with the VM through ssh. The key needs to be at least + /// 2048-bit and in ssh-rsa format. <br><br> For creating + /// ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + public SshPublicKey(string keyData = default(string)) + { + KeyData = keyData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets SSH public key certificate used to authenticate with + /// the VM through ssh. The key needs to be at least 2048-bit and in + /// ssh-rsa format. &lt;br&gt;&lt;br&gt; For creating + /// ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in + /// Azure](https://docs.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + /// + [JsonProperty(PropertyName = "keyData")] + public string KeyData { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/StopRequest.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/StopRequest.cs new file mode 100644 index 000000000000..010b5ed5ea69 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/StopRequest.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Stop SAP Request. + /// + public partial class StopRequest + { + /// + /// Initializes a new instance of the StopRequest class. + /// + public StopRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StopRequest class. + /// + /// A boolean to specify if the SAP system + /// should be hard-stopped. + public StopRequest(bool? hardStop = default(bool?)) + { + HardStop = hardStop; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a boolean to specify if the SAP system should be + /// hard-stopped. + /// + [JsonProperty(PropertyName = "hardStop")] + public bool? HardStop { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SystemData.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..da1bb6fe6e0b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/SystemData.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC). + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC) + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource last modification (UTC) + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Tags.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Tags.cs new file mode 100644 index 000000000000..2ea6a515dbb6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/Tags.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Tags field of the resource. + /// + public partial class Tags + { + /// + /// Initializes a new instance of the Tags class. + /// + public Tags() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Tags class. + /// + /// Tags field of the resource. + public Tags(IDictionary tagsProperty = default(IDictionary)) + { + TagsProperty = tagsProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets tags field of the resource. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary TagsProperty { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ThreeTierConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ThreeTierConfiguration.cs new file mode 100644 index 000000000000..6fa67b497d1e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ThreeTierConfiguration.cs @@ -0,0 +1,130 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the three tier SAP configuration. + /// + [Newtonsoft.Json.JsonObject("ThreeTier")] + public partial class ThreeTierConfiguration : InfrastructureConfiguration + { + /// + /// Initializes a new instance of the ThreeTierConfiguration class. + /// + public ThreeTierConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThreeTierConfiguration class. + /// + /// The application resource group where + /// SAP system resources will be deployed. + /// The central server + /// configuration. + /// The application server + /// configuration. + /// The database configuration. + /// Network configuration common to + /// all servers + /// The high availability + /// configuration. + public ThreeTierConfiguration(string appResourceGroup, CentralServerConfiguration centralServer, ApplicationServerConfiguration applicationServer, DatabaseConfiguration databaseServer, NetworkConfiguration networkConfiguration = default(NetworkConfiguration), HighAvailabilityConfiguration highAvailabilityConfig = default(HighAvailabilityConfiguration)) + : base(appResourceGroup) + { + NetworkConfiguration = networkConfiguration; + CentralServer = centralServer; + ApplicationServer = applicationServer; + DatabaseServer = databaseServer; + HighAvailabilityConfig = highAvailabilityConfig; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets network configuration common to all servers + /// + [JsonProperty(PropertyName = "networkConfiguration")] + public NetworkConfiguration NetworkConfiguration { get; set; } + + /// + /// Gets or sets the central server configuration. + /// + [JsonProperty(PropertyName = "centralServer")] + public CentralServerConfiguration CentralServer { get; set; } + + /// + /// Gets or sets the application server configuration. + /// + [JsonProperty(PropertyName = "applicationServer")] + public ApplicationServerConfiguration ApplicationServer { get; set; } + + /// + /// Gets or sets the database configuration. + /// + [JsonProperty(PropertyName = "databaseServer")] + public DatabaseConfiguration DatabaseServer { get; set; } + + /// + /// Gets or sets the high availability configuration. + /// + [JsonProperty(PropertyName = "highAvailabilityConfig")] + public HighAvailabilityConfiguration HighAvailabilityConfig { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (CentralServer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CentralServer"); + } + if (ApplicationServer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ApplicationServer"); + } + if (DatabaseServer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DatabaseServer"); + } + if (CentralServer != null) + { + CentralServer.Validate(); + } + if (ApplicationServer != null) + { + ApplicationServer.Validate(); + } + if (DatabaseServer != null) + { + DatabaseServer.Validate(); + } + if (HighAvailabilityConfig != null) + { + HighAvailabilityConfig.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ThreeTierRecommendationResult.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ThreeTierRecommendationResult.cs new file mode 100644 index 000000000000..f7a8da7de974 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/ThreeTierRecommendationResult.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The recommended configuration for a three tier SAP system. + /// + [Newtonsoft.Json.JsonObject("ThreeTier")] + public partial class ThreeTierRecommendationResult : SAPSizingRecommendationResult + { + /// + /// Initializes a new instance of the ThreeTierRecommendationResult + /// class. + /// + public ThreeTierRecommendationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThreeTierRecommendationResult + /// class. + /// + /// The database VM SKU. + /// The database server instance + /// count. + /// The central server VM SKU. + /// The central server + /// instance count. + /// The application server VM + /// SKU. + /// The application server + /// instance count. + public ThreeTierRecommendationResult(string dbVmSku = default(string), long? databaseInstanceCount = default(long?), string centralServerVmSku = default(string), long? centralServerInstanceCount = default(long?), string applicationServerVmSku = default(string), long? applicationServerInstanceCount = default(long?)) + { + DbVmSku = dbVmSku; + DatabaseInstanceCount = databaseInstanceCount; + CentralServerVmSku = centralServerVmSku; + CentralServerInstanceCount = centralServerInstanceCount; + ApplicationServerVmSku = applicationServerVmSku; + ApplicationServerInstanceCount = applicationServerInstanceCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the database VM SKU. + /// + [JsonProperty(PropertyName = "dbVmSku")] + public string DbVmSku { get; set; } + + /// + /// Gets or sets the database server instance count. + /// + [JsonProperty(PropertyName = "databaseInstanceCount")] + public long? DatabaseInstanceCount { get; set; } + + /// + /// Gets or sets the central server VM SKU. + /// + [JsonProperty(PropertyName = "centralServerVmSku")] + public string CentralServerVmSku { get; set; } + + /// + /// Gets or sets the central server instance count. + /// + [JsonProperty(PropertyName = "centralServerInstanceCount")] + public long? CentralServerInstanceCount { get; set; } + + /// + /// Gets or sets the application server VM SKU. + /// + [JsonProperty(PropertyName = "applicationServerVmSku")] + public string ApplicationServerVmSku { get; set; } + + /// + /// Gets or sets the application server instance count. + /// + [JsonProperty(PropertyName = "applicationServerInstanceCount")] + public long? ApplicationServerInstanceCount { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/TrackedResource.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/TrackedResource.cs new file mode 100644 index 000000000000..4b0ee7e94cd5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/TrackedResource.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Tracked Resource + /// + /// + /// The resource model definition for an Azure Resource Manager tracked top + /// level resource which has 'tags' and a 'location' + /// + public partial class TrackedResource : Resource + { + /// + /// Initializes a new instance of the TrackedResource class. + /// + public TrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrackedResource class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary)) + : base(id, name, type, systemData) + { + Tags = tags; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UpdateMonitorRequest.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UpdateMonitorRequest.cs new file mode 100644 index 000000000000..65e4da9cca0b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UpdateMonitorRequest.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the request body for updating SAP monitor resource. + /// + public partial class UpdateMonitorRequest + { + /// + /// Initializes a new instance of the UpdateMonitorRequest class. + /// + public UpdateMonitorRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateMonitorRequest class. + /// + /// Gets or sets the Resource tags. + public UpdateMonitorRequest(IDictionary tags = default(IDictionary), UserAssignedServiceIdentity identity = default(UserAssignedServiceIdentity)) + { + Tags = tags; + Identity = identity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "identity")] + public UserAssignedServiceIdentity Identity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identity != null) + { + Identity.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UpdateSAPApplicationInstanceRequest.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UpdateSAPApplicationInstanceRequest.cs new file mode 100644 index 000000000000..d8e5326280b0 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UpdateSAPApplicationInstanceRequest.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the request body for updating SAP Application Instance. + /// + public partial class UpdateSAPApplicationInstanceRequest + { + /// + /// Initializes a new instance of the + /// UpdateSAPApplicationInstanceRequest class. + /// + public UpdateSAPApplicationInstanceRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// UpdateSAPApplicationInstanceRequest class. + /// + /// Gets or sets the Resource tags. + public UpdateSAPApplicationInstanceRequest(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UpdateSAPCentralInstanceRequest.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UpdateSAPCentralInstanceRequest.cs new file mode 100644 index 000000000000..5d2984dcb138 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UpdateSAPCentralInstanceRequest.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the request body for updating SAP Central Instance. + /// + public partial class UpdateSAPCentralInstanceRequest + { + /// + /// Initializes a new instance of the UpdateSAPCentralInstanceRequest + /// class. + /// + public UpdateSAPCentralInstanceRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateSAPCentralInstanceRequest + /// class. + /// + /// Gets or sets the Resource tags. + public UpdateSAPCentralInstanceRequest(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UpdateSAPDatabaseInstanceRequest.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UpdateSAPDatabaseInstanceRequest.cs new file mode 100644 index 000000000000..b8171d49e928 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UpdateSAPDatabaseInstanceRequest.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the request body for updating SAP Database Instance. + /// + public partial class UpdateSAPDatabaseInstanceRequest + { + /// + /// Initializes a new instance of the UpdateSAPDatabaseInstanceRequest + /// class. + /// + public UpdateSAPDatabaseInstanceRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateSAPDatabaseInstanceRequest + /// class. + /// + /// Gets or sets the Resource tags. + public UpdateSAPDatabaseInstanceRequest(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UpdateSAPVirtualInstanceRequest.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UpdateSAPVirtualInstanceRequest.cs new file mode 100644 index 000000000000..3bbc22b417b5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UpdateSAPVirtualInstanceRequest.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the request body for updating Virtual Instance for SAP. + /// + public partial class UpdateSAPVirtualInstanceRequest + { + /// + /// Initializes a new instance of the UpdateSAPVirtualInstanceRequest + /// class. + /// + public UpdateSAPVirtualInstanceRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateSAPVirtualInstanceRequest + /// class. + /// + /// Gets or sets the Resource tags. + public UpdateSAPVirtualInstanceRequest(IDictionary tags = default(IDictionary), UserAssignedServiceIdentity identity = default(UserAssignedServiceIdentity)) + { + Tags = tags; + Identity = identity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "identity")] + public UserAssignedServiceIdentity Identity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identity != null) + { + Identity.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UserAssignedIdentity.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UserAssignedIdentity.cs new file mode 100644 index 000000000000..2c45596145c2 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UserAssignedIdentity.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// User assigned identity properties + /// + public partial class UserAssignedIdentity + { + /// + /// Initializes a new instance of the UserAssignedIdentity class. + /// + public UserAssignedIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserAssignedIdentity class. + /// + /// The principal ID of the assigned + /// identity. + /// The client ID of the assigned + /// identity. + public UserAssignedIdentity(System.Guid? principalId = default(System.Guid?), System.Guid? clientId = default(System.Guid?)) + { + PrincipalId = principalId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal ID of the assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public System.Guid? PrincipalId { get; private set; } + + /// + /// Gets the client ID of the assigned identity. + /// + [JsonProperty(PropertyName = "clientId")] + public System.Guid? ClientId { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UserAssignedServiceIdentity.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UserAssignedServiceIdentity.cs new file mode 100644 index 000000000000..f2be7372bc78 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UserAssignedServiceIdentity.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Managed service identity (user assigned identities) + /// + public partial class UserAssignedServiceIdentity + { + /// + /// Initializes a new instance of the UserAssignedServiceIdentity + /// class. + /// + public UserAssignedServiceIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserAssignedServiceIdentity + /// class. + /// + /// Type of manage identity. Possible values + /// include: 'None', 'UserAssigned' + /// User assigned identities + /// dictionary + public UserAssignedServiceIdentity(string type, IDictionary userAssignedIdentities = default(IDictionary)) + { + Type = type; + UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of manage identity. Possible values include: + /// 'None', 'UserAssigned' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets user assigned identities dictionary + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UserProfile.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UserProfile.cs new file mode 100644 index 000000000000..5baa11814e0a --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/UserProfile.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// User profile to configure on a compute resources such as VM, VMSS + /// + public partial class UserProfile + { + /// + /// Initializes a new instance of the UserProfile class. + /// + public UserProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserProfile class. + /// + /// User name + /// SSH public key data + public UserProfile(string userName, string sshPublicKey) + { + UserName = userName; + SshPublicKey = sshPublicKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets user name + /// + [JsonProperty(PropertyName = "userName")] + public string UserName { get; set; } + + /// + /// Gets or sets SSH public key data + /// + [JsonProperty(PropertyName = "sshPublicKey")] + public string SshPublicKey { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (UserName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "UserName"); + } + if (SshPublicKey == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SshPublicKey"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/VirtualMachineConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/VirtualMachineConfiguration.cs new file mode 100644 index 000000000000..d2f075cd07dc --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/VirtualMachineConfiguration.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the virtual machine configuration. + /// + public partial class VirtualMachineConfiguration + { + /// + /// Initializes a new instance of the VirtualMachineConfiguration + /// class. + /// + public VirtualMachineConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineConfiguration + /// class. + /// + /// The virtual machine size. + /// The image reference. + /// The OS profile. + public VirtualMachineConfiguration(string vmSize, ImageReference imageReference, OSProfile osProfile) + { + VmSize = vmSize; + ImageReference = imageReference; + OsProfile = osProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the virtual machine size. + /// + [JsonProperty(PropertyName = "vmSize")] + public string VmSize { get; set; } + + /// + /// Gets or sets the image reference. + /// + [JsonProperty(PropertyName = "imageReference")] + public ImageReference ImageReference { get; set; } + + /// + /// Gets or sets the OS profile. + /// + [JsonProperty(PropertyName = "osProfile")] + public OSProfile OsProfile { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (VmSize == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VmSize"); + } + if (ImageReference == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ImageReference"); + } + if (OsProfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OsProfile"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/VmssNodesProfile.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/VmssNodesProfile.cs new file mode 100644 index 000000000000..609da6bcd951 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/VmssNodesProfile.cs @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// VMSS profile + /// + public partial class VmssNodesProfile : NodeProfile + { + /// + /// Initializes a new instance of the VmssNodesProfile class. + /// + public VmssNodesProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VmssNodesProfile class. + /// + /// VM SKU for node(s) + /// OS image used for creating the nodes + /// OS disk details + /// VM or VMSS name + /// Data disks details. This property is not in + /// use right now + /// VM/VMSS resource ARM Ids + /// Minimum number of nodes for + /// autoscale + /// Maximum number of nodes for + /// autoscale + public VmssNodesProfile(string nodeSku, OsImageProfile osImage, DiskInfo osDisk, string name = default(string), IList dataDisks = default(IList), IList nodeResourceIds = default(IList), int? autoScaleMinCount = default(int?), int? autoScaleMaxCount = default(int?)) + : base(nodeSku, osImage, osDisk, name, dataDisks, nodeResourceIds) + { + AutoScaleMinCount = autoScaleMinCount; + AutoScaleMaxCount = autoScaleMaxCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets minimum number of nodes for autoscale + /// + [JsonProperty(PropertyName = "autoScaleMinCount")] + public int? AutoScaleMinCount { get; set; } + + /// + /// Gets or sets maximum number of nodes for autoscale + /// + [JsonProperty(PropertyName = "autoScaleMaxCount")] + public int? AutoScaleMaxCount { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (AutoScaleMinCount < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "AutoScaleMinCount", 1); + } + if (AutoScaleMaxCount < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "AutoScaleMaxCount", 1); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/WindowsConfiguration.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/WindowsConfiguration.cs new file mode 100644 index 000000000000..5c45cddcf239 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/WindowsConfiguration.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies Windows operating system settings on the virtual machine. + /// + [Newtonsoft.Json.JsonObject("Windows")] + public partial class WindowsConfiguration : OSConfiguration + { + /// + /// Initializes a new instance of the WindowsConfiguration class. + /// + public WindowsConfiguration() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/WordpressInstanceResource.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/WordpressInstanceResource.cs new file mode 100644 index 000000000000..7612d22752f6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/WordpressInstanceResource.cs @@ -0,0 +1,118 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// WordPress instance resource + /// + [Rest.Serialization.JsonTransformation] + public partial class WordpressInstanceResource : ProxyResource + { + /// + /// Initializes a new instance of the WordpressInstanceResource class. + /// + public WordpressInstanceResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WordpressInstanceResource class. + /// + /// Application version. Possible values include: + /// '5.4.3', '5.4.2', '5.4.1', '5.4' + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Database name used by the + /// application + /// User name used by the application to + /// connect to database + /// Site Url to access the WordPress + /// application + /// WordPress instance provisioning + /// state. Possible values include: 'NotSpecified', 'Accepted', + /// 'Created', 'Succeeded', 'Failed', 'Canceled', 'Installing' + public WordpressInstanceResource(string version, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string databaseName = default(string), string databaseUser = default(string), string siteUrl = default(string), string provisioningState = default(string)) + : base(id, name, type, systemData) + { + Version = version; + DatabaseName = databaseName; + DatabaseUser = databaseUser; + SiteUrl = siteUrl; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets application version. Possible values include: '5.4.3', + /// '5.4.2', '5.4.1', '5.4' + /// + [JsonProperty(PropertyName = "properties.version")] + public string Version { get; set; } + + /// + /// Gets or sets database name used by the application + /// + [JsonProperty(PropertyName = "properties.databaseName")] + public string DatabaseName { get; set; } + + /// + /// Gets or sets user name used by the application to connect to + /// database + /// + [JsonProperty(PropertyName = "properties.databaseUser")] + public string DatabaseUser { get; set; } + + /// + /// Gets site Url to access the WordPress application + /// + [JsonProperty(PropertyName = "properties.siteUrl")] + public string SiteUrl { get; private set; } + + /// + /// Gets wordPress instance provisioning state. Possible values + /// include: 'NotSpecified', 'Accepted', 'Created', 'Succeeded', + /// 'Failed', 'Canceled', 'Installing' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Version"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/WordpressVersions.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/WordpressVersions.cs new file mode 100644 index 000000000000..c554bdc1d997 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/WordpressVersions.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for WordpressVersions. + /// + public static class WordpressVersions + { + public const string FiveFullStopFourFullStopThree = "5.4.3"; + public const string FiveFullStopFourFullStopTwo = "5.4.2"; + public const string FiveFullStopFourFullStopOne = "5.4.1"; + public const string FiveFullStopFour = "5.4"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/WorkloadMonitorActionType.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/WorkloadMonitorActionType.cs new file mode 100644 index 000000000000..582c04c6a24a --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/WorkloadMonitorActionType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for WorkloadMonitorActionType. + /// + public static class WorkloadMonitorActionType + { + public const string NotSpecified = "NotSpecified"; + public const string Internal = "Internal"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Models/WorkloadMonitorProvisioningState.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/WorkloadMonitorProvisioningState.cs new file mode 100644 index 000000000000..259b0aded51c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Models/WorkloadMonitorProvisioningState.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.Models +{ + + /// + /// Defines values for WorkloadMonitorProvisioningState. + /// + public static class WorkloadMonitorProvisioningState + { + public const string Accepted = "Accepted"; + public const string Creating = "Creating"; + public const string Updating = "Updating"; + public const string Failed = "Failed"; + public const string Succeeded = "Succeeded"; + public const string Deleting = "Deleting"; + public const string Migrating = "Migrating"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/MonitorsOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/MonitorsOperations.cs new file mode 100644 index 000000000000..55e978a36f72 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/MonitorsOperations.cs @@ -0,0 +1,1783 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MonitorsOperations operations. + /// + internal partial class MonitorsOperations : IServiceOperations, IMonitorsOperations + { + /// + /// Initializes a new instance of the MonitorsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MonitorsOperations(WorkloadsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the WorkloadsClient + /// + public WorkloadsClient Client { get; private set; } + + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The operations + /// returns various properties of each SAP monitor. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Workloads/monitors").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets properties of a SAP monitor. + /// + /// + /// Gets properties of a SAP monitor for the specified subscription, resource + /// group, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource group, and + /// resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, Monitor monitorParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, monitorName, monitorParameter, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource group, and + /// SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, monitorName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Patches the Tags field of a SAP monitor. + /// + /// + /// Patches the Tags field of a SAP monitor for the specified subscription, + /// resource group, and SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The Update SAP workload monitor request body. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string monitorName, UpdateMonitorRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource group, and + /// resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, Monitor monitorParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (monitorParameter == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorParameter"); + } + if (monitorParameter != null) + { + monitorParameter.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("monitorParameter", monitorParameter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(monitorParameter != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(monitorParameter, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource group, and + /// SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The operations + /// returns various properties of each SAP monitor. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/MonitorsOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/MonitorsOperationsExtensions.cs new file mode 100644 index 000000000000..60089b12ef7d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/MonitorsOperationsExtensions.cs @@ -0,0 +1,489 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for MonitorsOperations. + /// + public static partial class MonitorsOperationsExtensions + { + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The operations + /// returns various properties of each SAP monitor. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IMonitorsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The operations + /// returns various properties of each SAP monitor. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IMonitorsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this IMonitorsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IMonitorsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets properties of a SAP monitor. + /// + /// + /// Gets properties of a SAP monitor for the specified subscription, resource + /// group, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + public static Monitor Get(this IMonitorsOperations operations, string resourceGroupName, string monitorName) + { + return operations.GetAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// Gets properties of a SAP monitor. + /// + /// + /// Gets properties of a SAP monitor for the specified subscription, resource + /// group, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource group, and + /// resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + public static Monitor Create(this IMonitorsOperations operations, string resourceGroupName, string monitorName, Monitor monitorParameter) + { + return operations.CreateAsync(resourceGroupName, monitorName, monitorParameter).GetAwaiter().GetResult(); + } + + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource group, and + /// resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, Monitor monitorParameter, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, monitorName, monitorParameter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource group, and + /// SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + public static OperationStatusResult Delete(this IMonitorsOperations operations, string resourceGroupName, string monitorName) + { + return operations.DeleteAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource group, and + /// SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Patches the Tags field of a SAP monitor. + /// + /// + /// Patches the Tags field of a SAP monitor for the specified subscription, + /// resource group, and SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The Update SAP workload monitor request body. + /// + public static Monitor Update(this IMonitorsOperations operations, string resourceGroupName, string monitorName, UpdateMonitorRequest body) + { + return operations.UpdateAsync(resourceGroupName, monitorName, body).GetAwaiter().GetResult(); + } + + /// + /// Patches the Tags field of a SAP monitor. + /// + /// + /// Patches the Tags field of a SAP monitor for the specified subscription, + /// resource group, and SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The Update SAP workload monitor request body. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, UpdateMonitorRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, monitorName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource group, and + /// resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + public static Monitor BeginCreate(this IMonitorsOperations operations, string resourceGroupName, string monitorName, Monitor monitorParameter) + { + return operations.BeginCreateAsync(resourceGroupName, monitorName, monitorParameter).GetAwaiter().GetResult(); + } + + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource group, and + /// resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, Monitor monitorParameter, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, monitorName, monitorParameter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource group, and + /// SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + public static OperationStatusResult BeginDelete(this IMonitorsOperations operations, string resourceGroupName, string monitorName) + { + return operations.BeginDeleteAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource group, and + /// SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The operations + /// returns various properties of each SAP monitor. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IMonitorsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The operations + /// returns various properties of each SAP monitor. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IMonitorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IMonitorsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IMonitorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/Operations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/Operations.cs new file mode 100644 index 000000000000..2ac6eed777f6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/Operations.cs @@ -0,0 +1,397 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(WorkloadsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the WorkloadsClient + /// + public WorkloadsClient Client { get; private set; } + + /// + /// Lists all the available API operations under this PR + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Workloads/operations").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the available API operations under this PR + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/OperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..4b1116081056 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/OperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Lists all the available API operations under this PR + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all the available API operations under this PR + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the available API operations under this PR + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the available API operations under this PR + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/PhpWorkloadsOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/PhpWorkloadsOperations.cs new file mode 100644 index 000000000000..2ed879b1d8ea --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/PhpWorkloadsOperations.cs @@ -0,0 +1,1742 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PhpWorkloadsOperations operations. + /// + internal partial class PhpWorkloadsOperations : IServiceOperations, IPhpWorkloadsOperations + { + /// + /// Initializes a new instance of the PhpWorkloadsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PhpWorkloadsOperations(WorkloadsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the WorkloadsClient + /// + public WorkloadsClient Client { get; private set; } + + /// + /// Lists PHP workload resources for a subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Workloads/phpWorkloads").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists PHP workload resources in a resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the PHP workload resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (phpWorkloadName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "phpWorkloadName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("phpWorkloadName", phpWorkloadName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{phpWorkloadName}", System.Uri.EscapeDataString(phpWorkloadName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or updated PHP workload resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, PhpWorkloadResource phpWorkloadResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, phpWorkloadName, phpWorkloadResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update PHP workload resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Workload resource update data + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, PatchResourceRequestBody resourcePatchRequestBody, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (phpWorkloadName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "phpWorkloadName"); + } + if (resourcePatchRequestBody == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourcePatchRequestBody"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("phpWorkloadName", phpWorkloadName); + tracingParameters.Add("resourcePatchRequestBody", resourcePatchRequestBody); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{phpWorkloadName}", System.Uri.EscapeDataString(phpWorkloadName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(resourcePatchRequestBody != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(resourcePatchRequestBody, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete PHP workload resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Whether to delete infra along with workload resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, string deleteInfra = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, phpWorkloadName, deleteInfra, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or updated PHP workload resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, PhpWorkloadResource phpWorkloadResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (phpWorkloadName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "phpWorkloadName"); + } + if (phpWorkloadResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "phpWorkloadResource"); + } + if (phpWorkloadResource != null) + { + phpWorkloadResource.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("phpWorkloadName", phpWorkloadName); + tracingParameters.Add("phpWorkloadResource", phpWorkloadResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{phpWorkloadName}", System.Uri.EscapeDataString(phpWorkloadName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(phpWorkloadResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(phpWorkloadResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete PHP workload resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Whether to delete infra along with workload resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, string deleteInfra = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (phpWorkloadName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "phpWorkloadName"); + } + if (deleteInfra != null) + { + if (deleteInfra.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "deleteInfra", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("phpWorkloadName", phpWorkloadName); + tracingParameters.Add("deleteInfra", deleteInfra); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{phpWorkloadName}", System.Uri.EscapeDataString(phpWorkloadName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (deleteInfra != null) + { + _queryParameters.Add(string.Format("delete-infra={0}", System.Uri.EscapeDataString(deleteInfra))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists PHP workload resources for a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists PHP workload resources in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/PhpWorkloadsOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/PhpWorkloadsOperationsExtensions.cs new file mode 100644 index 000000000000..d2f5ca5d7675 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/PhpWorkloadsOperationsExtensions.cs @@ -0,0 +1,419 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PhpWorkloadsOperations. + /// + public static partial class PhpWorkloadsOperationsExtensions + { + /// + /// Lists PHP workload resources for a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this IPhpWorkloadsOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists PHP workload resources for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IPhpWorkloadsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists PHP workload resources in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this IPhpWorkloadsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists PHP workload resources in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IPhpWorkloadsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the PHP workload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + public static PhpWorkloadResource Get(this IPhpWorkloadsOperations operations, string resourceGroupName, string phpWorkloadName) + { + return operations.GetAsync(resourceGroupName, phpWorkloadName).GetAwaiter().GetResult(); + } + + /// + /// Gets the PHP workload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPhpWorkloadsOperations operations, string resourceGroupName, string phpWorkloadName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, phpWorkloadName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or updated PHP workload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + public static PhpWorkloadResource CreateOrUpdate(this IPhpWorkloadsOperations operations, string resourceGroupName, string phpWorkloadName, PhpWorkloadResource phpWorkloadResource) + { + return operations.CreateOrUpdateAsync(resourceGroupName, phpWorkloadName, phpWorkloadResource).GetAwaiter().GetResult(); + } + + /// + /// Create or updated PHP workload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IPhpWorkloadsOperations operations, string resourceGroupName, string phpWorkloadName, PhpWorkloadResource phpWorkloadResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, phpWorkloadName, phpWorkloadResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update PHP workload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Workload resource update data + /// + public static PhpWorkloadResource Update(this IPhpWorkloadsOperations operations, string resourceGroupName, string phpWorkloadName, PatchResourceRequestBody resourcePatchRequestBody) + { + return operations.UpdateAsync(resourceGroupName, phpWorkloadName, resourcePatchRequestBody).GetAwaiter().GetResult(); + } + + /// + /// Update PHP workload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Workload resource update data + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IPhpWorkloadsOperations operations, string resourceGroupName, string phpWorkloadName, PatchResourceRequestBody resourcePatchRequestBody, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, phpWorkloadName, resourcePatchRequestBody, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete PHP workload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Whether to delete infra along with workload resource. + /// + public static void Delete(this IPhpWorkloadsOperations operations, string resourceGroupName, string phpWorkloadName, string deleteInfra = default(string)) + { + operations.DeleteAsync(resourceGroupName, phpWorkloadName, deleteInfra).GetAwaiter().GetResult(); + } + + /// + /// Delete PHP workload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Whether to delete infra along with workload resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPhpWorkloadsOperations operations, string resourceGroupName, string phpWorkloadName, string deleteInfra = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, phpWorkloadName, deleteInfra, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create or updated PHP workload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + public static PhpWorkloadResource BeginCreateOrUpdate(this IPhpWorkloadsOperations operations, string resourceGroupName, string phpWorkloadName, PhpWorkloadResource phpWorkloadResource) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, phpWorkloadName, phpWorkloadResource).GetAwaiter().GetResult(); + } + + /// + /// Create or updated PHP workload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IPhpWorkloadsOperations operations, string resourceGroupName, string phpWorkloadName, PhpWorkloadResource phpWorkloadResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, phpWorkloadName, phpWorkloadResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete PHP workload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Whether to delete infra along with workload resource. + /// + public static void BeginDelete(this IPhpWorkloadsOperations operations, string resourceGroupName, string phpWorkloadName, string deleteInfra = default(string)) + { + operations.BeginDeleteAsync(resourceGroupName, phpWorkloadName, deleteInfra).GetAwaiter().GetResult(); + } + + /// + /// Delete PHP workload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Whether to delete infra along with workload resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IPhpWorkloadsOperations operations, string resourceGroupName, string phpWorkloadName, string deleteInfra = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, phpWorkloadName, deleteInfra, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists PHP workload resources for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IPhpWorkloadsOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists PHP workload resources for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IPhpWorkloadsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists PHP workload resources in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IPhpWorkloadsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists PHP workload resources in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IPhpWorkloadsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/ProviderInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/ProviderInstancesOperations.cs new file mode 100644 index 000000000000..b1757c27d97c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/ProviderInstancesOperations.cs @@ -0,0 +1,1230 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProviderInstancesOperations operations. + /// + internal partial class ProviderInstancesOperations : IServiceOperations, IProviderInstancesOperations + { + /// + /// Initializes a new instance of the ProviderInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ProviderInstancesOperations(WorkloadsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the WorkloadsClient + /// + public WorkloadsClient Client { get; private set; } + + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets properties of a provider instance. + /// + /// + /// Gets properties of a provider instance for the specified subscription, + /// resource group, SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (providerInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "providerInstanceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("providerInstanceName", providerInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + _url = _url.Replace("{providerInstanceName}", System.Uri.EscapeDataString(providerInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Request body representing a provider instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, ProviderInstance providerInstanceParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, monitorName, providerInstanceName, providerInstanceParameter, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, monitorName, providerInstanceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Request body representing a provider instance + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, ProviderInstance providerInstanceParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (providerInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "providerInstanceName"); + } + if (providerInstanceParameter == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "providerInstanceParameter"); + } + if (providerInstanceParameter != null) + { + providerInstanceParameter.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("providerInstanceName", providerInstanceName); + tracingParameters.Add("providerInstanceParameter", providerInstanceParameter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + _url = _url.Replace("{providerInstanceName}", System.Uri.EscapeDataString(providerInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(providerInstanceParameter != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(providerInstanceParameter, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (providerInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "providerInstanceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("providerInstanceName", providerInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + _url = _url.Replace("{providerInstanceName}", System.Uri.EscapeDataString(providerInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/ProviderInstancesOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/ProviderInstancesOperationsExtensions.cs new file mode 100644 index 000000000000..ea3f2a90cfac --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/ProviderInstancesOperationsExtensions.cs @@ -0,0 +1,397 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ProviderInstancesOperations. + /// + public static partial class ProviderInstancesOperationsExtensions + { + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + public static IPage List(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName) + { + return operations.ListAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets properties of a provider instance. + /// + /// + /// Gets properties of a provider instance for the specified subscription, + /// resource group, SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + public static ProviderInstance Get(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName) + { + return operations.GetAsync(resourceGroupName, monitorName, providerInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets properties of a provider instance. + /// + /// + /// Gets properties of a provider instance for the specified subscription, + /// resource group, SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, monitorName, providerInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Request body representing a provider instance + /// + public static ProviderInstance Create(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName, ProviderInstance providerInstanceParameter) + { + return operations.CreateAsync(resourceGroupName, monitorName, providerInstanceName, providerInstanceParameter).GetAwaiter().GetResult(); + } + + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Request body representing a provider instance + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName, ProviderInstance providerInstanceParameter, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, monitorName, providerInstanceName, providerInstanceParameter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + public static OperationStatusResult Delete(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName) + { + return operations.DeleteAsync(resourceGroupName, monitorName, providerInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, monitorName, providerInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Request body representing a provider instance + /// + public static ProviderInstance BeginCreate(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName, ProviderInstance providerInstanceParameter) + { + return operations.BeginCreateAsync(resourceGroupName, monitorName, providerInstanceName, providerInstanceParameter).GetAwaiter().GetResult(); + } + + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Request body representing a provider instance + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName, ProviderInstance providerInstanceParameter, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, monitorName, providerInstanceName, providerInstanceParameter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + public static OperationStatusResult BeginDelete(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName) + { + return operations.BeginDeleteAsync(resourceGroupName, monitorName, providerInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, monitorName, providerInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IProviderInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IProviderInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/SAPApplicationServerInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPApplicationServerInstancesOperations.cs new file mode 100644 index 000000000000..0d21e0c1d256 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPApplicationServerInstancesOperations.cs @@ -0,0 +1,1496 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SAPApplicationServerInstancesOperations operations. + /// + internal partial class SAPApplicationServerInstancesOperations : IServiceOperations, ISAPApplicationServerInstancesOperations + { + /// + /// Initializes a new instance of the SAPApplicationServerInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SAPApplicationServerInstancesOperations(WorkloadsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the WorkloadsClient + /// + public WorkloadsClient Client { get; private set; } + + /// + /// Gets the SAP Application Server Instance corresponding to the Virtual + /// Instance for SAP solutions resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (applicationInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("applicationInstanceName", applicationInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + _url = _url.Replace("{applicationInstanceName}", System.Uri.EscapeDataString(applicationInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Puts the SAP Application Server Instance resource. <br><br>This + /// will be used by service only. PUT by end user will return a Bad Request + /// error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// The SAP Application Server Instance resource request body. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, SAPApplicationServerInstance body = default(SAPApplicationServerInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Puts the SAP Application Server Instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, tags, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the SAP Application Server Instance resource. + /// <br><br>This operation will be used by service only. Delete by + /// end user will return a Bad Request error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists the SAP Application Server Instance resources for a given Virtual + /// Instance for SAP solutions resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Puts the SAP Application Server Instance resource. <br><br>This + /// will be used by service only. PUT by end user will return a Bad Request + /// error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// The SAP Application Server Instance resource request body. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, SAPApplicationServerInstance body = default(SAPApplicationServerInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (applicationInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("applicationInstanceName", applicationInstanceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + _url = _url.Replace("{applicationInstanceName}", System.Uri.EscapeDataString(applicationInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Puts the SAP Application Server Instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (applicationInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + UpdateSAPApplicationInstanceRequest body = default(UpdateSAPApplicationInstanceRequest); + if (tags != null) + { + body = new UpdateSAPApplicationInstanceRequest(); + body.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("applicationInstanceName", applicationInstanceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + _url = _url.Replace("{applicationInstanceName}", System.Uri.EscapeDataString(applicationInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the SAP Application Server Instance resource. + /// <br><br>This operation will be used by service only. Delete by + /// end user will return a Bad Request error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (applicationInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("applicationInstanceName", applicationInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/applicationInstances/{applicationInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + _url = _url.Replace("{applicationInstanceName}", System.Uri.EscapeDataString(applicationInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the SAP Application Server Instance resources for a given Virtual + /// Instance for SAP solutions resource. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/SAPApplicationServerInstancesOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPApplicationServerInstancesOperationsExtensions.cs new file mode 100644 index 000000000000..2e74eeca9adc --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPApplicationServerInstancesOperationsExtensions.cs @@ -0,0 +1,469 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SAPApplicationServerInstancesOperations. + /// + public static partial class SAPApplicationServerInstancesOperationsExtensions + { + /// + /// Gets the SAP Application Server Instance corresponding to the Virtual + /// Instance for SAP solutions resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + public static SAPApplicationServerInstance Get(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName) + { + return operations.GetAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the SAP Application Server Instance corresponding to the Virtual + /// Instance for SAP solutions resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Puts the SAP Application Server Instance resource. <br><br>This + /// will be used by service only. PUT by end user will return a Bad Request + /// error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// The SAP Application Server Instance resource request body. + /// + public static SAPApplicationServerInstance Create(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, SAPApplicationServerInstance body = default(SAPApplicationServerInstance)) + { + return operations.CreateAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, body).GetAwaiter().GetResult(); + } + + /// + /// Puts the SAP Application Server Instance resource. <br><br>This + /// will be used by service only. PUT by end user will return a Bad Request + /// error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// The SAP Application Server Instance resource request body. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, SAPApplicationServerInstance body = default(SAPApplicationServerInstance), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Puts the SAP Application Server Instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// Gets or sets the Resource tags. + /// + public static SAPApplicationServerInstance Update(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Puts the SAP Application Server Instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the SAP Application Server Instance resource. + /// <br><br>This operation will be used by service only. Delete by + /// end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + public static OperationStatusResult Delete(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName) + { + return operations.DeleteAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the SAP Application Server Instance resource. + /// <br><br>This operation will be used by service only. Delete by + /// end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the SAP Application Server Instance resources for a given Virtual + /// Instance for SAP solutions resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + public static IPage List(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName) + { + return operations.ListAsync(resourceGroupName, sapVirtualInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Lists the SAP Application Server Instance resources for a given Virtual + /// Instance for SAP solutions resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Puts the SAP Application Server Instance resource. <br><br>This + /// will be used by service only. PUT by end user will return a Bad Request + /// error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// The SAP Application Server Instance resource request body. + /// + public static SAPApplicationServerInstance BeginCreate(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, SAPApplicationServerInstance body = default(SAPApplicationServerInstance)) + { + return operations.BeginCreateAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, body).GetAwaiter().GetResult(); + } + + /// + /// Puts the SAP Application Server Instance resource. <br><br>This + /// will be used by service only. PUT by end user will return a Bad Request + /// error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// The SAP Application Server Instance resource request body. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, SAPApplicationServerInstance body = default(SAPApplicationServerInstance), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Puts the SAP Application Server Instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// Gets or sets the Resource tags. + /// + public static SAPApplicationServerInstance BeginUpdate(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, IDictionary tags = default(IDictionary)) + { + return operations.BeginUpdateAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Puts the SAP Application Server Instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the SAP Application Server Instance resource. + /// <br><br>This operation will be used by service only. Delete by + /// end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + public static OperationStatusResult BeginDelete(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName) + { + return operations.BeginDeleteAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the SAP Application Server Instance resource. + /// <br><br>This operation will be used by service only. Delete by + /// end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The name of SAP Application Server instance resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the SAP Application Server Instance resources for a given Virtual + /// Instance for SAP solutions resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISAPApplicationServerInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the SAP Application Server Instance resources for a given Virtual + /// Instance for SAP solutions resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISAPApplicationServerInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/SAPCentralInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPCentralInstancesOperations.cs new file mode 100644 index 000000000000..cdaa75f6281e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPCentralInstancesOperations.cs @@ -0,0 +1,1508 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SAPCentralInstancesOperations operations. + /// + internal partial class SAPCentralInstancesOperations : IServiceOperations, ISAPCentralInstancesOperations + { + /// + /// Initializes a new instance of the SAPCentralInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SAPCentralInstancesOperations(WorkloadsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the WorkloadsClient + /// + public WorkloadsClient Client { get; private set; } + + /// + /// Gets the SAP Central Services Instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (centralInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "centralInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("centralInstanceName", centralInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + _url = _url.Replace("{centralInstanceName}", System.Uri.EscapeDataString(centralInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. PUT operation on + /// this resource by end user will return a Bad Request error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// The SAP Central Services Instance request body. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, SAPCentralServerInstance body = default(SAPCentralServerInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates the SAP Central Services Instance resource. + /// <br><br>This can be used to update tags on the resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, tags, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. Delete operation on + /// this resource by end user will return a Bad Request error. You can delete + /// the parent resource, which is the Virtual Instance for SAP solutions + /// resource, using the delete operation on it. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists the SAP Central Services Instance resource for the given Virtual + /// Instance for SAP solutions resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. PUT operation on + /// this resource by end user will return a Bad Request error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// The SAP Central Services Instance request body. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, SAPCentralServerInstance body = default(SAPCentralServerInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (centralInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "centralInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("centralInstanceName", centralInstanceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + _url = _url.Replace("{centralInstanceName}", System.Uri.EscapeDataString(centralInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates the SAP Central Services Instance resource. + /// <br><br>This can be used to update tags on the resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (centralInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "centralInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + UpdateSAPCentralInstanceRequest body = default(UpdateSAPCentralInstanceRequest); + if (tags != null) + { + body = new UpdateSAPCentralInstanceRequest(); + body.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("centralInstanceName", centralInstanceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + _url = _url.Replace("{centralInstanceName}", System.Uri.EscapeDataString(centralInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. Delete operation on + /// this resource by end user will return a Bad Request error. You can delete + /// the parent resource, which is the Virtual Instance for SAP solutions + /// resource, using the delete operation on it. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (centralInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "centralInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("centralInstanceName", centralInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/centralInstances/{centralInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + _url = _url.Replace("{centralInstanceName}", System.Uri.EscapeDataString(centralInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the SAP Central Services Instance resource for the given Virtual + /// Instance for SAP solutions resource. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/SAPCentralInstancesOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPCentralInstancesOperationsExtensions.cs new file mode 100644 index 000000000000..995bc8c28506 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPCentralInstancesOperationsExtensions.cs @@ -0,0 +1,493 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SAPCentralInstancesOperations. + /// + public static partial class SAPCentralInstancesOperationsExtensions + { + /// + /// Gets the SAP Central Services Instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + public static SAPCentralServerInstance Get(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName) + { + return operations.GetAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the SAP Central Services Instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. PUT operation on + /// this resource by end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// The SAP Central Services Instance request body. + /// + public static SAPCentralServerInstance Create(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, SAPCentralServerInstance body = default(SAPCentralServerInstance)) + { + return operations.CreateAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, body).GetAwaiter().GetResult(); + } + + /// + /// Creates the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. PUT operation on + /// this resource by end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// The SAP Central Services Instance request body. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, SAPCentralServerInstance body = default(SAPCentralServerInstance), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the SAP Central Services Instance resource. + /// <br><br>This can be used to update tags on the resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + public static SAPCentralServerInstance Update(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates the SAP Central Services Instance resource. + /// <br><br>This can be used to update tags on the resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. Delete operation on + /// this resource by end user will return a Bad Request error. You can delete + /// the parent resource, which is the Virtual Instance for SAP solutions + /// resource, using the delete operation on it. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + public static OperationStatusResult Delete(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName) + { + return operations.DeleteAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. Delete operation on + /// this resource by end user will return a Bad Request error. You can delete + /// the parent resource, which is the Virtual Instance for SAP solutions + /// resource, using the delete operation on it. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the SAP Central Services Instance resource for the given Virtual + /// Instance for SAP solutions resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + public static IPage List(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName) + { + return operations.ListAsync(resourceGroupName, sapVirtualInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Lists the SAP Central Services Instance resource for the given Virtual + /// Instance for SAP solutions resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. PUT operation on + /// this resource by end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// The SAP Central Services Instance request body. + /// + public static SAPCentralServerInstance BeginCreate(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, SAPCentralServerInstance body = default(SAPCentralServerInstance)) + { + return operations.BeginCreateAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, body).GetAwaiter().GetResult(); + } + + /// + /// Creates the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. PUT operation on + /// this resource by end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// The SAP Central Services Instance request body. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, SAPCentralServerInstance body = default(SAPCentralServerInstance), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the SAP Central Services Instance resource. + /// <br><br>This can be used to update tags on the resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + public static SAPCentralServerInstance BeginUpdate(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, IDictionary tags = default(IDictionary)) + { + return operations.BeginUpdateAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates the SAP Central Services Instance resource. + /// <br><br>This can be used to update tags on the resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. Delete operation on + /// this resource by end user will return a Bad Request error. You can delete + /// the parent resource, which is the Virtual Instance for SAP solutions + /// resource, using the delete operation on it. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + public static OperationStatusResult BeginDelete(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName) + { + return operations.BeginDeleteAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the SAP Central Services Instance resource. + /// <br><br>This will be used by service only. Delete operation on + /// this resource by end user will return a Bad Request error. You can delete + /// the parent resource, which is the Virtual Instance for SAP solutions + /// resource, using the delete operation on it. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the SAP Central Services Instance resource for the given Virtual + /// Instance for SAP solutions resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISAPCentralInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the SAP Central Services Instance resource for the given Virtual + /// Instance for SAP solutions resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISAPCentralInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/SAPDatabaseInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPDatabaseInstancesOperations.cs new file mode 100644 index 000000000000..e355bc252412 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPDatabaseInstancesOperations.cs @@ -0,0 +1,1502 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SAPDatabaseInstancesOperations operations. + /// + internal partial class SAPDatabaseInstancesOperations : IServiceOperations, ISAPDatabaseInstancesOperations + { + /// + /// Initializes a new instance of the SAPDatabaseInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SAPDatabaseInstancesOperations(WorkloadsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the WorkloadsClient + /// + public WorkloadsClient Client { get; private set; } + + /// + /// Gets the SAP Database Instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (databaseInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("databaseInstanceName", databaseInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + _url = _url.Replace("{databaseInstanceName}", System.Uri.EscapeDataString(databaseInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates the Database resource corresponding to the Virtual Instance for SAP + /// solutions resource. <br><br>This will be used by service only. + /// PUT by end user will return a Bad Request error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// Request body of Database resource of a SAP system. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, SAPDatabaseInstance body = default(SAPDatabaseInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates the Database resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, tags, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the Database resource corresponding to a Virtual Instance for SAP + /// solutions resource. <br><br>This will be used by service only. + /// Delete by end user will return a Bad Request error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists the Database resources associated with a Virtual Instance for SAP + /// solutions resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates the Database resource corresponding to the Virtual Instance for SAP + /// solutions resource. <br><br>This will be used by service only. + /// PUT by end user will return a Bad Request error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// Request body of Database resource of a SAP system. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, SAPDatabaseInstance body = default(SAPDatabaseInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (databaseInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("databaseInstanceName", databaseInstanceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + _url = _url.Replace("{databaseInstanceName}", System.Uri.EscapeDataString(databaseInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates the Database resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (databaseInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + UpdateSAPDatabaseInstanceRequest body = default(UpdateSAPDatabaseInstanceRequest); + if (tags != null) + { + body = new UpdateSAPDatabaseInstanceRequest(); + body.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("databaseInstanceName", databaseInstanceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + _url = _url.Replace("{databaseInstanceName}", System.Uri.EscapeDataString(databaseInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the Database resource corresponding to a Virtual Instance for SAP + /// solutions resource. <br><br>This will be used by service only. + /// Delete by end user will return a Bad Request error. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (databaseInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("databaseInstanceName", databaseInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/databaseInstances/{databaseInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + _url = _url.Replace("{databaseInstanceName}", System.Uri.EscapeDataString(databaseInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the Database resources associated with a Virtual Instance for SAP + /// solutions resource. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/SAPDatabaseInstancesOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPDatabaseInstancesOperationsExtensions.cs new file mode 100644 index 000000000000..35809b5b6875 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPDatabaseInstancesOperationsExtensions.cs @@ -0,0 +1,481 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SAPDatabaseInstancesOperations. + /// + public static partial class SAPDatabaseInstancesOperationsExtensions + { + /// + /// Gets the SAP Database Instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + public static SAPDatabaseInstance Get(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName) + { + return operations.GetAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the SAP Database Instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates the Database resource corresponding to the Virtual Instance for SAP + /// solutions resource. <br><br>This will be used by service only. + /// PUT by end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// Request body of Database resource of a SAP system. + /// + public static SAPDatabaseInstance Create(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, SAPDatabaseInstance body = default(SAPDatabaseInstance)) + { + return operations.CreateAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, body).GetAwaiter().GetResult(); + } + + /// + /// Creates the Database resource corresponding to the Virtual Instance for SAP + /// solutions resource. <br><br>This will be used by service only. + /// PUT by end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// Request body of Database resource of a SAP system. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, SAPDatabaseInstance body = default(SAPDatabaseInstance), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the Database resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + public static SAPDatabaseInstance Update(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates the Database resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the Database resource corresponding to a Virtual Instance for SAP + /// solutions resource. <br><br>This will be used by service only. + /// Delete by end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + public static OperationStatusResult Delete(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName) + { + return operations.DeleteAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the Database resource corresponding to a Virtual Instance for SAP + /// solutions resource. <br><br>This will be used by service only. + /// Delete by end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the Database resources associated with a Virtual Instance for SAP + /// solutions resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + public static IPage List(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName) + { + return operations.ListAsync(resourceGroupName, sapVirtualInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Lists the Database resources associated with a Virtual Instance for SAP + /// solutions resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates the Database resource corresponding to the Virtual Instance for SAP + /// solutions resource. <br><br>This will be used by service only. + /// PUT by end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// Request body of Database resource of a SAP system. + /// + public static SAPDatabaseInstance BeginCreate(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, SAPDatabaseInstance body = default(SAPDatabaseInstance)) + { + return operations.BeginCreateAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, body).GetAwaiter().GetResult(); + } + + /// + /// Creates the Database resource corresponding to the Virtual Instance for SAP + /// solutions resource. <br><br>This will be used by service only. + /// PUT by end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// Request body of Database resource of a SAP system. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, SAPDatabaseInstance body = default(SAPDatabaseInstance), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the Database resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + public static SAPDatabaseInstance BeginUpdate(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, IDictionary tags = default(IDictionary)) + { + return operations.BeginUpdateAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates the Database resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// Gets or sets the Resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the Database resource corresponding to a Virtual Instance for SAP + /// solutions resource. <br><br>This will be used by service only. + /// Delete by end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + public static OperationStatusResult BeginDelete(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName) + { + return operations.BeginDeleteAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the Database resource corresponding to a Virtual Instance for SAP + /// solutions resource. <br><br>This will be used by service only. + /// Delete by end user will return a Bad Request error. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Database resource name string modeled as parameter for auto generation to + /// work correctly. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the Database resources associated with a Virtual Instance for SAP + /// solutions resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISAPDatabaseInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the Database resources associated with a Virtual Instance for SAP + /// solutions resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISAPDatabaseInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/SAPVirtualInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPVirtualInstancesOperations.cs new file mode 100644 index 000000000000..7dd0f064a01f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPVirtualInstancesOperations.cs @@ -0,0 +1,2240 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SAPVirtualInstancesOperations operations. + /// + internal partial class SAPVirtualInstancesOperations : IServiceOperations, ISAPVirtualInstancesOperations + { + /// + /// Initializes a new instance of the SAPVirtualInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SAPVirtualInstancesOperations(WorkloadsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the WorkloadsClient + /// + public WorkloadsClient Client { get; private set; } + + /// + /// Creates a Virtual Instance for SAP solutions (VIS) resource + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Virtual Instance for SAP solutions resource request body. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, SAPVirtualInstance body = default(SAPVirtualInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Virtual Instance for SAP solutions resource + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a Virtual Instance for SAP solutions resource + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Request body to update a Virtual Instance for SAP solutions resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, UpdateSAPVirtualInstanceRequest body = default(UpdateSAPVirtualInstanceRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a Virtual Instance for SAP solutions resource and its child + /// resources, that is the associated Central Services Instance, Application + /// Server Instances and Database Instance. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets all Virtual Instances for SAP solutions resources in a Resource Group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all Virtual Instances for SAP solutions resources in a Subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Workloads/sapVirtualInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Starts the SAP application, that is the Central Services instance and + /// Application server instances. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> StartWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Stops the SAP Application, that is the Application server instances and + /// Central Services instance. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// A boolean to specify if the SAP system should be hard-stopped. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> StopWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, bool? hardStop = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, hardStop, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a Virtual Instance for SAP solutions (VIS) resource + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Virtual Instance for SAP solutions resource request body. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, SAPVirtualInstance body = default(SAPVirtualInstance), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a Virtual Instance for SAP solutions resource and its child + /// resources, that is the associated Central Services Instance, Application + /// Server Instances and Database Instance. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Starts the SAP application, that is the Central Services instance and + /// Application server instances. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginStartWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStart", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/start").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Stops the SAP Application, that is the Application server instances and + /// Central Services instance. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// A boolean to specify if the SAP system should be hard-stopped. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginStopWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, bool? hardStop = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (sapVirtualInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapVirtualInstanceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + StopRequest body = default(StopRequest); + if (hardStop != null) + { + body = new StopRequest(); + body.HardStop = hardStop; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sapVirtualInstanceName", sapVirtualInstanceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStop", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}/stop").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sapVirtualInstanceName}", System.Uri.EscapeDataString(sapVirtualInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all Virtual Instances for SAP solutions resources in a Resource Group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all Virtual Instances for SAP solutions resources in a Subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/SAPVirtualInstancesOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPVirtualInstancesOperationsExtensions.cs new file mode 100644 index 000000000000..84025ad3b892 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/SAPVirtualInstancesOperationsExtensions.cs @@ -0,0 +1,601 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SAPVirtualInstancesOperations. + /// + public static partial class SAPVirtualInstancesOperationsExtensions + { + /// + /// Creates a Virtual Instance for SAP solutions (VIS) resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Virtual Instance for SAP solutions resource request body. + /// + public static SAPVirtualInstance Create(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, SAPVirtualInstance body = default(SAPVirtualInstance)) + { + return operations.CreateAsync(resourceGroupName, sapVirtualInstanceName, body).GetAwaiter().GetResult(); + } + + /// + /// Creates a Virtual Instance for SAP solutions (VIS) resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Virtual Instance for SAP solutions resource request body. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, SAPVirtualInstance body = default(SAPVirtualInstance), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a Virtual Instance for SAP solutions resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + public static SAPVirtualInstance Get(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName) + { + return operations.GetAsync(resourceGroupName, sapVirtualInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a Virtual Instance for SAP solutions resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a Virtual Instance for SAP solutions resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Request body to update a Virtual Instance for SAP solutions resource. + /// + public static SAPVirtualInstance Update(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, UpdateSAPVirtualInstanceRequest body = default(UpdateSAPVirtualInstanceRequest)) + { + return operations.UpdateAsync(resourceGroupName, sapVirtualInstanceName, body).GetAwaiter().GetResult(); + } + + /// + /// Updates a Virtual Instance for SAP solutions resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Request body to update a Virtual Instance for SAP solutions resource. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, UpdateSAPVirtualInstanceRequest body = default(UpdateSAPVirtualInstanceRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Virtual Instance for SAP solutions resource and its child + /// resources, that is the associated Central Services Instance, Application + /// Server Instances and Database Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + public static OperationStatusResult Delete(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName) + { + return operations.DeleteAsync(resourceGroupName, sapVirtualInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Virtual Instance for SAP solutions resource and its child + /// resources, that is the associated Central Services Instance, Application + /// Server Instances and Database Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all Virtual Instances for SAP solutions resources in a Resource Group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this ISAPVirtualInstancesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets all Virtual Instances for SAP solutions resources in a Resource Group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all Virtual Instances for SAP solutions resources in a Subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this ISAPVirtualInstancesOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets all Virtual Instances for SAP solutions resources in a Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this ISAPVirtualInstancesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Starts the SAP application, that is the Central Services instance and + /// Application server instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + public static OperationStatusResult Start(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName) + { + return operations.StartAsync(resourceGroupName, sapVirtualInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Starts the SAP application, that is the Central Services instance and + /// Application server instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.StartWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Stops the SAP Application, that is the Application server instances and + /// Central Services instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// A boolean to specify if the SAP system should be hard-stopped. + /// + public static OperationStatusResult Stop(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, bool? hardStop = false) + { + return operations.StopAsync(resourceGroupName, sapVirtualInstanceName, hardStop).GetAwaiter().GetResult(); + } + + /// + /// Stops the SAP Application, that is the Application server instances and + /// Central Services instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// A boolean to specify if the SAP system should be hard-stopped. + /// + /// + /// The cancellation token. + /// + public static async Task StopAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, bool? hardStop = false, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.StopWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, hardStop, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a Virtual Instance for SAP solutions (VIS) resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Virtual Instance for SAP solutions resource request body. + /// + public static SAPVirtualInstance BeginCreate(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, SAPVirtualInstance body = default(SAPVirtualInstance)) + { + return operations.BeginCreateAsync(resourceGroupName, sapVirtualInstanceName, body).GetAwaiter().GetResult(); + } + + /// + /// Creates a Virtual Instance for SAP solutions (VIS) resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// Virtual Instance for SAP solutions resource request body. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, SAPVirtualInstance body = default(SAPVirtualInstance), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Virtual Instance for SAP solutions resource and its child + /// resources, that is the associated Central Services Instance, Application + /// Server Instances and Database Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + public static OperationStatusResult BeginDelete(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName) + { + return operations.BeginDeleteAsync(resourceGroupName, sapVirtualInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Virtual Instance for SAP solutions resource and its child + /// resources, that is the associated Central Services Instance, Application + /// Server Instances and Database Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Starts the SAP application, that is the Central Services instance and + /// Application server instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + public static OperationStatusResult BeginStart(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName) + { + return operations.BeginStartAsync(resourceGroupName, sapVirtualInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Starts the SAP application, that is the Central Services instance and + /// Application server instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Stops the SAP Application, that is the Application server instances and + /// Central Services instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// A boolean to specify if the SAP system should be hard-stopped. + /// + public static OperationStatusResult BeginStop(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, bool? hardStop = false) + { + return operations.BeginStopAsync(resourceGroupName, sapVirtualInstanceName, hardStop).GetAwaiter().GetResult(); + } + + /// + /// Stops the SAP Application, that is the Application server instances and + /// Central Services instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Virtual Instances for SAP solutions resource + /// + /// + /// A boolean to specify if the SAP system should be hard-stopped. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStopAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, bool? hardStop = false, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginStopWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, hardStop, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all Virtual Instances for SAP solutions resources in a Resource Group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this ISAPVirtualInstancesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all Virtual Instances for SAP solutions resources in a Resource Group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this ISAPVirtualInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all Virtual Instances for SAP solutions resources in a Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this ISAPVirtualInstancesOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all Virtual Instances for SAP solutions resources in a Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this ISAPVirtualInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/SdkInfo_WorkloadsClient.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/SdkInfo_WorkloadsClient.cs new file mode 100644 index 000000000000..38b9938d87cf --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/SdkInfo_WorkloadsClient.cs @@ -0,0 +1,40 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_WorkloadsClient + { + get + { + return new Tuple[] + { + new Tuple("Workloads", "Operations", "2021-12-01-preview"), + new Tuple("Workloads", "PhpWorkloads", "2021-12-01-preview"), + new Tuple("Workloads", "ProviderInstances", "2021-12-01-preview"), + new Tuple("Workloads", "SAPApplicationServerInstances", "2021-12-01-preview"), + new Tuple("Workloads", "SAPAvailabilityZoneDetails", "2021-12-01-preview"), + new Tuple("Workloads", "SAPCentralInstances", "2021-12-01-preview"), + new Tuple("Workloads", "SAPDatabaseInstances", "2021-12-01-preview"), + new Tuple("Workloads", "SAPDiskConfigurations", "2021-12-01-preview"), + new Tuple("Workloads", "SAPSizingRecommendations", "2021-12-01-preview"), + new Tuple("Workloads", "SAPSupportedSku", "2021-12-01-preview"), + new Tuple("Workloads", "SAPVirtualInstances", "2021-12-01-preview"), + new Tuple("Workloads", "Skus", "2021-12-01-preview"), + new Tuple("Workloads", "WordpressInstances", "2021-12-01-preview"), + new Tuple("Workloads", "monitors", "2021-12-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/SkusOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/SkusOperations.cs new file mode 100644 index 000000000000..716ef372dfeb --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/SkusOperations.cs @@ -0,0 +1,409 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SkusOperations operations. + /// + internal partial class SkusOperations : IServiceOperations, ISkusOperations + { + /// + /// Initializes a new instance of the SkusOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SkusOperations(WorkloadsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the WorkloadsClient + /// + public WorkloadsClient Client { get; private set; } + + /// + /// Lists all the available SKUs under this PR + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Workloads/skus").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the available SKUs under this PR + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/SkusOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/SkusOperationsExtensions.cs new file mode 100644 index 000000000000..4a5c25056a57 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/SkusOperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SkusOperations. + /// + public static partial class SkusOperationsExtensions + { + /// + /// Lists all the available SKUs under this PR + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this ISkusOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all the available SKUs under this PR + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISkusOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the available SKUs under this PR + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISkusOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the available SKUs under this PR + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISkusOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/WordpressInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/WordpressInstancesOperations.cs new file mode 100644 index 000000000000..6312705e3ee3 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/WordpressInstancesOperations.cs @@ -0,0 +1,1126 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WordpressInstancesOperations operations. + /// + internal partial class WordpressInstancesOperations : IServiceOperations, IWordpressInstancesOperations + { + /// + /// Initializes a new instance of the WordpressInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WordpressInstancesOperations(WorkloadsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the WorkloadsClient + /// + public WorkloadsClient Client { get; private set; } + + /// + /// Lists WordPress instance resources under a phpWorkload resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (phpWorkloadName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "phpWorkloadName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("phpWorkloadName", phpWorkloadName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{phpWorkloadName}", System.Uri.EscapeDataString(phpWorkloadName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the WordPress instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (phpWorkloadName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "phpWorkloadName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("phpWorkloadName", phpWorkloadName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{phpWorkloadName}", System.Uri.EscapeDataString(phpWorkloadName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or updated WordPress instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, WordpressInstanceResource wordpressInstanceResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, phpWorkloadName, wordpressInstanceResource, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete WordPress instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (phpWorkloadName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "phpWorkloadName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("phpWorkloadName", phpWorkloadName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{phpWorkloadName}", System.Uri.EscapeDataString(phpWorkloadName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or updated WordPress instance resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string phpWorkloadName, WordpressInstanceResource wordpressInstanceResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (phpWorkloadName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "phpWorkloadName"); + } + if (wordpressInstanceResource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "wordpressInstanceResource"); + } + if (wordpressInstanceResource != null) + { + wordpressInstanceResource.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("phpWorkloadName", phpWorkloadName); + tracingParameters.Add("wordpressInstanceResource", wordpressInstanceResource); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/phpWorkloads/{phpWorkloadName}/wordpressInstances/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{phpWorkloadName}", System.Uri.EscapeDataString(phpWorkloadName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(wordpressInstanceResource != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(wordpressInstanceResource, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists WordPress instance resources under a phpWorkload resource. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/WordpressInstancesOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/WordpressInstancesOperationsExtensions.cs new file mode 100644 index 000000000000..6172b8168be4 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/WordpressInstancesOperationsExtensions.cs @@ -0,0 +1,268 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WordpressInstancesOperations. + /// + public static partial class WordpressInstancesOperationsExtensions + { + /// + /// Lists WordPress instance resources under a phpWorkload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + public static IPage List(this IWordpressInstancesOperations operations, string resourceGroupName, string phpWorkloadName) + { + return operations.ListAsync(resourceGroupName, phpWorkloadName).GetAwaiter().GetResult(); + } + + /// + /// Lists WordPress instance resources under a phpWorkload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IWordpressInstancesOperations operations, string resourceGroupName, string phpWorkloadName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, phpWorkloadName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the WordPress instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + public static WordpressInstanceResource Get(this IWordpressInstancesOperations operations, string resourceGroupName, string phpWorkloadName) + { + return operations.GetAsync(resourceGroupName, phpWorkloadName).GetAwaiter().GetResult(); + } + + /// + /// Gets the WordPress instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IWordpressInstancesOperations operations, string resourceGroupName, string phpWorkloadName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, phpWorkloadName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or updated WordPress instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + public static WordpressInstanceResource CreateOrUpdate(this IWordpressInstancesOperations operations, string resourceGroupName, string phpWorkloadName, WordpressInstanceResource wordpressInstanceResource) + { + return operations.CreateOrUpdateAsync(resourceGroupName, phpWorkloadName, wordpressInstanceResource).GetAwaiter().GetResult(); + } + + /// + /// Create or updated WordPress instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IWordpressInstancesOperations operations, string resourceGroupName, string phpWorkloadName, WordpressInstanceResource wordpressInstanceResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, phpWorkloadName, wordpressInstanceResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete WordPress instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + public static void Delete(this IWordpressInstancesOperations operations, string resourceGroupName, string phpWorkloadName) + { + operations.DeleteAsync(resourceGroupName, phpWorkloadName).GetAwaiter().GetResult(); + } + + /// + /// Delete WordPress instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IWordpressInstancesOperations operations, string resourceGroupName, string phpWorkloadName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, phpWorkloadName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create or updated WordPress instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + public static WordpressInstanceResource BeginCreateOrUpdate(this IWordpressInstancesOperations operations, string resourceGroupName, string phpWorkloadName, WordpressInstanceResource wordpressInstanceResource) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, phpWorkloadName, wordpressInstanceResource).GetAwaiter().GetResult(); + } + + /// + /// Create or updated WordPress instance resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Php workload name + /// + /// + /// Resource create or update request payload + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IWordpressInstancesOperations operations, string resourceGroupName, string phpWorkloadName, WordpressInstanceResource wordpressInstanceResource, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, phpWorkloadName, wordpressInstanceResource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists WordPress instance resources under a phpWorkload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IWordpressInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists WordPress instance resources under a phpWorkload resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IWordpressInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/WorkloadsClient.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/WorkloadsClient.cs new file mode 100644 index 000000000000..e830c2da5b92 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/WorkloadsClient.cs @@ -0,0 +1,1294 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + public partial class WorkloadsClient : ServiceClient, IWorkloadsClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// The API version to use for this operation. + /// + public string ApiVersion { get; private set; } + + /// + /// The ID of the target subscription. + /// + public string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IPhpWorkloadsOperations. + /// + public virtual IPhpWorkloadsOperations PhpWorkloads { get; private set; } + + /// + /// Gets the IWordpressInstancesOperations. + /// + public virtual IWordpressInstancesOperations WordpressInstances { get; private set; } + + /// + /// Gets the ISAPVirtualInstancesOperations. + /// + public virtual ISAPVirtualInstancesOperations SAPVirtualInstances { get; private set; } + + /// + /// Gets the ISAPCentralInstancesOperations. + /// + public virtual ISAPCentralInstancesOperations SAPCentralInstances { get; private set; } + + /// + /// Gets the ISAPDatabaseInstancesOperations. + /// + public virtual ISAPDatabaseInstancesOperations SAPDatabaseInstances { get; private set; } + + /// + /// Gets the ISAPApplicationServerInstancesOperations. + /// + public virtual ISAPApplicationServerInstancesOperations SAPApplicationServerInstances { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IMonitorsOperations. + /// + public virtual IMonitorsOperations Monitors { get; private set; } + + /// + /// Gets the IProviderInstancesOperations. + /// + public virtual IProviderInstancesOperations ProviderInstances { get; private set; } + + /// + /// Gets the ISkusOperations. + /// + public virtual ISkusOperations Skus { get; private set; } + + /// + /// Initializes a new instance of the WorkloadsClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling WorkloadsClient.Dispose(). False: will not dispose provided httpClient + protected WorkloadsClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the WorkloadsClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected WorkloadsClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the WorkloadsClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected WorkloadsClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the WorkloadsClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected WorkloadsClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the WorkloadsClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected WorkloadsClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the WorkloadsClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public WorkloadsClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the WorkloadsClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling WorkloadsClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public WorkloadsClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the WorkloadsClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public WorkloadsClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the WorkloadsClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public WorkloadsClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the WorkloadsClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public WorkloadsClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + PhpWorkloads = new PhpWorkloadsOperations(this); + WordpressInstances = new WordpressInstancesOperations(this); + SAPVirtualInstances = new SAPVirtualInstancesOperations(this); + SAPCentralInstances = new SAPCentralInstancesOperations(this); + SAPDatabaseInstances = new SAPDatabaseInstancesOperations(this); + SAPApplicationServerInstances = new SAPApplicationServerInstancesOperations(this); + Operations = new Operations(this); + Monitors = new MonitorsOperations(this); + ProviderInstances = new ProviderInstancesOperations(this); + Skus = new SkusOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2021-12-01-preview"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("osType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("osType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("deploymentType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("deploymentType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("deploymentType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("deploymentType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("softwareInstallationType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("softwareInstallationType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("configurationType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("configurationType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("providerType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("providerType")); + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + /// + /// Get SAP sizing recommendations by providing input SAPS for application tier + /// and memory required for database tier + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Sizing Recommendation Request body + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> SAPSizingRecommendationsWithHttpMessagesAsync(string location, SAPSizingRecommendationRequest sAPSizingRecommendation = default(SAPSizingRecommendationRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + if (SubscriptionId != null) + { + if (SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SubscriptionId", 1); + } + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (location.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "location", 1); + } + } + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + if (ApiVersion != null) + { + if (ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ApiVersion", 1); + } + } + if (sAPSizingRecommendation != null) + { + sAPSizingRecommendation.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("sAPSizingRecommendation", sAPSizingRecommendation); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "SAPSizingRecommendations", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSizingRecommendations").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + List _queryParameters = new List(); + if (ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(sAPSizingRecommendation != null) + { + _requestContent = SafeJsonConvert.SerializeObject(sAPSizingRecommendation, SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get a list of SAP supported SKUs for ASCS, Application and Database tier. + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Supported SKU Request body + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> SAPSupportedSkuMethodWithHttpMessagesAsync(string location, SAPSupportedSkusRequest sAPSupportedSku = default(SAPSupportedSkusRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + if (SubscriptionId != null) + { + if (SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SubscriptionId", 1); + } + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (location.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "location", 1); + } + } + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + if (ApiVersion != null) + { + if (ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ApiVersion", 1); + } + } + if (sAPSupportedSku != null) + { + sAPSupportedSku.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("sAPSupportedSku", sAPSupportedSku); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "SAPSupportedSkuMethod", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getSapSupportedSku").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + List _queryParameters = new List(); + if (ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(sAPSupportedSku != null) + { + _requestContent = SafeJsonConvert.SerializeObject(sAPSupportedSku, SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the SAP Disk Configuration Layout prod/non-prod SAP System. + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Disk Configurations Request body + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> SAPDiskConfigurationsWithHttpMessagesAsync(string location, SAPDiskConfigurationsRequest sAPDiskConfigurations = default(SAPDiskConfigurationsRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + if (SubscriptionId != null) + { + if (SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SubscriptionId", 1); + } + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (location.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "location", 1); + } + } + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + if (ApiVersion != null) + { + if (ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ApiVersion", 1); + } + } + if (sAPDiskConfigurations != null) + { + sAPDiskConfigurations.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("sAPDiskConfigurations", sAPDiskConfigurations); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "SAPDiskConfigurations", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getDiskConfigurations").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + List _queryParameters = new List(); + if (ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(sAPDiskConfigurations != null) + { + _requestContent = SafeJsonConvert.SerializeObject(sAPDiskConfigurations, SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the recommended SAP Availability Zone Pair Details for your region. + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Availability Zone Details Request body + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> SAPAvailabilityZoneDetailsWithHttpMessagesAsync(string location, SAPAvailabilityZoneDetailsRequest sAPAvailabilityZoneDetails = default(SAPAvailabilityZoneDetailsRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + if (SubscriptionId != null) + { + if (SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SubscriptionId", 1); + } + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (location.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "location", 1); + } + } + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + if (ApiVersion != null) + { + if (ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ApiVersion", 1); + } + } + if (sAPAvailabilityZoneDetails != null) + { + sAPAvailabilityZoneDetails.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("sAPAvailabilityZoneDetails", sAPAvailabilityZoneDetails); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "SAPAvailabilityZoneDetails", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Workloads/locations/{location}/sapVirtualInstanceMetadata/default/getAvailabilityZoneDetails").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + List _queryParameters = new List(); + if (ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(sAPAvailabilityZoneDetails != null) + { + _requestContent = SafeJsonConvert.SerializeObject(sAPAvailabilityZoneDetails, SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads/src/Generated/WorkloadsClientExtensions.cs b/sdk/workloads/Microsoft.Workloads/src/Generated/WorkloadsClientExtensions.cs new file mode 100644 index 000000000000..4023c5bd08b8 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads/src/Generated/WorkloadsClientExtensions.cs @@ -0,0 +1,187 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WorkloadsClient. + /// + public static partial class WorkloadsClientExtensions + { + /// + /// Get SAP sizing recommendations by providing input SAPS for application tier + /// and memory required for database tier + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Sizing Recommendation Request body + /// + public static SAPSizingRecommendationResult SAPSizingRecommendations(this IWorkloadsClient operations, string location, SAPSizingRecommendationRequest sAPSizingRecommendation = default(SAPSizingRecommendationRequest)) + { + return operations.SAPSizingRecommendationsAsync(location, sAPSizingRecommendation).GetAwaiter().GetResult(); + } + + /// + /// Get SAP sizing recommendations by providing input SAPS for application tier + /// and memory required for database tier + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Sizing Recommendation Request body + /// + /// + /// The cancellation token. + /// + public static async Task SAPSizingRecommendationsAsync(this IWorkloadsClient operations, string location, SAPSizingRecommendationRequest sAPSizingRecommendation = default(SAPSizingRecommendationRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.SAPSizingRecommendationsWithHttpMessagesAsync(location, sAPSizingRecommendation, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a list of SAP supported SKUs for ASCS, Application and Database tier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Supported SKU Request body + /// + public static SAPSupportedResourceSkusResult SAPSupportedSkuMethod(this IWorkloadsClient operations, string location, SAPSupportedSkusRequest sAPSupportedSku = default(SAPSupportedSkusRequest)) + { + return operations.SAPSupportedSkuMethodAsync(location, sAPSupportedSku).GetAwaiter().GetResult(); + } + + /// + /// Get a list of SAP supported SKUs for ASCS, Application and Database tier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Supported SKU Request body + /// + /// + /// The cancellation token. + /// + public static async Task SAPSupportedSkuMethodAsync(this IWorkloadsClient operations, string location, SAPSupportedSkusRequest sAPSupportedSku = default(SAPSupportedSkusRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.SAPSupportedSkuMethodWithHttpMessagesAsync(location, sAPSupportedSku, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the SAP Disk Configuration Layout prod/non-prod SAP System. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Disk Configurations Request body + /// + public static SAPDiskConfigurationsResult SAPDiskConfigurations(this IWorkloadsClient operations, string location, SAPDiskConfigurationsRequest sAPDiskConfigurations = default(SAPDiskConfigurationsRequest)) + { + return operations.SAPDiskConfigurationsAsync(location, sAPDiskConfigurations).GetAwaiter().GetResult(); + } + + /// + /// Get the SAP Disk Configuration Layout prod/non-prod SAP System. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Disk Configurations Request body + /// + /// + /// The cancellation token. + /// + public static async Task SAPDiskConfigurationsAsync(this IWorkloadsClient operations, string location, SAPDiskConfigurationsRequest sAPDiskConfigurations = default(SAPDiskConfigurationsRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.SAPDiskConfigurationsWithHttpMessagesAsync(location, sAPDiskConfigurations, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the recommended SAP Availability Zone Pair Details for your region. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Availability Zone Details Request body + /// + public static SAPAvailabilityZoneDetailsResult SAPAvailabilityZoneDetails(this IWorkloadsClient operations, string location, SAPAvailabilityZoneDetailsRequest sAPAvailabilityZoneDetails = default(SAPAvailabilityZoneDetailsRequest)) + { + return operations.SAPAvailabilityZoneDetailsAsync(location, sAPAvailabilityZoneDetails).GetAwaiter().GetResult(); + } + + /// + /// Get the recommended SAP Availability Zone Pair Details for your region. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of Azure region. + /// + /// + /// SAP Availability Zone Details Request body + /// + /// + /// The cancellation token. + /// + public static async Task SAPAvailabilityZoneDetailsAsync(this IWorkloadsClient operations, string location, SAPAvailabilityZoneDetailsRequest sAPAvailabilityZoneDetails = default(SAPAvailabilityZoneDetailsRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.SAPAvailabilityZoneDetailsWithHttpMessagesAsync(location, sAPAvailabilityZoneDetails, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}