diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/IOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/IOperations.cs new file mode 100644 index 0000000000000..145660393790a --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance +{ + 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.SAPVirtualInstance/src/Generated/ISAPApplicationServerInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/ISAPApplicationServerInstancesOperations.cs new file mode 100644 index 0000000000000..be9c2e558164d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/ISAPApplicationServerInstancesOperations.cs @@ -0,0 +1,383 @@ +// +// 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.SAPVirtualInstance +{ + 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)); + /// + /// Updates the SAP Application server instance resource. 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 + /// + /// + /// 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 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)); + /// + /// Starts the SAP Application Server Instance. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines + /// before starting the SAP instances. + /// + /// + /// 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> StartInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, bool? startVm = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stops the SAP Application Server Instance. + /// + /// + /// 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. + /// + /// + /// SAP Application server instance stop 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> StopInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, StopRequest body = default(StopRequest), 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)); + /// + /// 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 a required parameter is null + /// + Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts the SAP Application Server Instance. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines + /// before starting the SAP instances. + /// + /// + /// 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> BeginStartInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, bool? startVm = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stops the SAP Application Server Instance. + /// + /// + /// 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. + /// + /// + /// SAP Application server instance stop 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> BeginStopInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, StopRequest body = default(StopRequest), 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.SAPVirtualInstance/src/Generated/ISAPCentralInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/ISAPCentralInstancesOperations.cs new file mode 100644 index 0000000000000..388f082c25607 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/ISAPCentralInstancesOperations.cs @@ -0,0 +1,401 @@ +// +// 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.SAPVirtualInstance +{ + 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 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)); + /// + /// Starts the SAP Central Services Instance. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines + /// before starting the SAP instances. + /// + /// + /// 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> StartInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, bool? startVm = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stops the SAP Central Services Instance. + /// + /// + /// 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. + /// + /// + /// SAP Central Services instance stop 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> StopInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, StopRequest body = default(StopRequest), 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)); + /// + /// 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 a required parameter is null + /// + Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts the SAP Central Services Instance. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines + /// before starting the SAP instances. + /// + /// + /// 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> BeginStartInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, bool? startVm = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stops the SAP Central Services Instance. + /// + /// + /// 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. + /// + /// + /// SAP Central Services instance stop 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> BeginStopInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, StopRequest body = default(StopRequest), 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.SAPVirtualInstance/src/Generated/ISAPDatabaseInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/ISAPDatabaseInstancesOperations.cs new file mode 100644 index 0000000000000..57d88d4f39cbc --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/ISAPDatabaseInstancesOperations.cs @@ -0,0 +1,394 @@ +// +// 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.SAPVirtualInstance +{ + 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 instance resource. 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 + /// + /// + /// 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 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)); + /// + /// Starts the database instance of the SAP system. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines + /// before starting the SAP instances. + /// + /// + /// 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> StartInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, bool? startVm = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stops the database instance of the SAP system. + /// + /// + /// 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. + /// + /// + /// Stop request for the database instance of the 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> StopInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, StopRequest body = default(StopRequest), 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)); + /// + /// 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 a required parameter is null + /// + Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts the database instance of the SAP system. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines + /// before starting the SAP instances. + /// + /// + /// 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> BeginStartInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, bool? startVm = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stops the database instance of the SAP system. + /// + /// + /// 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. + /// + /// + /// Stop request for the database instance of the 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> BeginStopInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, StopRequest body = default(StopRequest), 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.SAPVirtualInstance/src/Generated/ISAPVirtualInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/ISAPVirtualInstancesOperations.cs new file mode 100644 index 0000000000000..0692faabb69f4 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/ISAPVirtualInstancesOperations.cs @@ -0,0 +1,421 @@ +// +// 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.SAPVirtualInstance +{ + 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, SAPVirtualInstanceModel body = default(SAPVirtualInstanceModel), 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 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 boolean value indicates whether to start the virtual machines + /// before starting the SAP instances. + /// + /// + /// 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, bool? startVm = false, 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 + /// + /// + /// The Virtual Instance for SAP solutions resource stop 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> StopWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, StopRequest body = default(StopRequest), 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, SAPVirtualInstanceModel body = default(SAPVirtualInstanceModel), 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> BeginUpdateWithHttpMessagesAsync(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 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 boolean value indicates whether to start the virtual machines + /// before starting the SAP instances. + /// + /// + /// 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, bool? startVm = false, 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 + /// + /// + /// The Virtual Instance for SAP solutions resource stop 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> BeginStopWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, StopRequest body = default(StopRequest), 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.SAPVirtualInstance/src/Generated/IWorkloadsClient.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/IWorkloadsClient.cs new file mode 100644 index 0000000000000..6105f1fabcdba --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/IWorkloadsClient.cs @@ -0,0 +1,167 @@ +// +// 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.SAPVirtualInstance +{ + 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 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 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; } + + /// + /// 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.SAPVirtualInstance/src/Generated/Models/ActionType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ActionType.cs new file mode 100644 index 0000000000000..21e161835b44a --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.Models +{ + + /// + /// Defines values for ActionType. + /// + public static class ActionType + { + public const string Internal = "Internal"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ApplicationServerConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ApplicationServerConfiguration.cs new file mode 100644 index 0000000000000..7eba2662029f5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ApplicationServerFullResourceNames.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ApplicationServerFullResourceNames.cs new file mode 100644 index 0000000000000..fe59b90861447 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ApplicationServerFullResourceNames.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The full resource names object for application layer resources. The + /// number of entries in this list should be equal to the number VMs to be + /// created for application layer. + /// + public partial class ApplicationServerFullResourceNames + { + /// + /// Initializes a new instance of the + /// ApplicationServerFullResourceNames class. + /// + public ApplicationServerFullResourceNames() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationServerFullResourceNames class. + /// + /// The list of virtual machine naming + /// details. + /// The full name for availability + /// set. In case name is not provided, it will be defaulted to + /// {SID}-App-AvSet. + public ApplicationServerFullResourceNames(IList virtualMachines = default(IList), string availabilitySetName = default(string)) + { + VirtualMachines = virtualMachines; + AvailabilitySetName = availabilitySetName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of virtual machine naming details. + /// + [JsonProperty(PropertyName = "virtualMachines")] + public IList VirtualMachines { get; set; } + + /// + /// Gets or sets the full name for availability set. In case name is + /// not provided, it will be defaulted to {SID}-App-AvSet. + /// + [JsonProperty(PropertyName = "availabilitySetName")] + public string AvailabilitySetName { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ApplicationServerVirtualMachineType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ApplicationServerVirtualMachineType.cs new file mode 100644 index 0000000000000..4673bb5cd6434 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ApplicationServerVirtualMachineType.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.SAPVirtualInstance.Models +{ + + /// + /// Defines values for ApplicationServerVirtualMachineType. + /// + public static class ApplicationServerVirtualMachineType + { + public const string Active = "Active"; + public const string Standby = "Standby"; + public const string Unknown = "Unknown"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ApplicationServerVmDetails.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ApplicationServerVmDetails.cs new file mode 100644 index 0000000000000..bd0fef4efdfbe --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ApplicationServerVmDetails.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Application Server VM Details. + /// + public partial class ApplicationServerVmDetails + { + /// + /// Initializes a new instance of the ApplicationServerVmDetails class. + /// + public ApplicationServerVmDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationServerVmDetails class. + /// + /// Possible values include: 'Active', 'Standby', + /// 'Unknown' + /// Storage details of all the Storage + /// Accounts attached to the App Virtual Machine. For e.g. NFS on AFS + /// Shared Storage. + public ApplicationServerVmDetails(string type = default(string), string virtualMachineId = default(string), IList storageDetails = default(IList)) + { + Type = type; + VirtualMachineId = virtualMachineId; + StorageDetails = storageDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets possible values include: 'Active', 'Standby', 'Unknown' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "virtualMachineId")] + public string VirtualMachineId { get; private set; } + + /// + /// Gets storage details of all the Storage Accounts attached to the + /// App Virtual Machine. For e.g. NFS on AFS Shared Storage. + /// + [JsonProperty(PropertyName = "storageDetails")] + public IList StorageDetails { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/AzureEntityResource.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/AzureEntityResource.cs new file mode 100644 index 0000000000000..d10f53059ab09 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/CentralServerConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/CentralServerConfiguration.cs new file mode 100644 index 0000000000000..ebaa9fa2f6d65 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/CentralServerFullResourceNames.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/CentralServerFullResourceNames.cs new file mode 100644 index 0000000000000..6c3a59a11f21e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/CentralServerFullResourceNames.cs @@ -0,0 +1,107 @@ +// +// 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.SAPVirtualInstance.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The full resource names object for central server layer resources. + /// + public partial class CentralServerFullResourceNames + { + /// + /// Initializes a new instance of the CentralServerFullResourceNames + /// class. + /// + public CentralServerFullResourceNames() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CentralServerFullResourceNames + /// class. + /// + /// The list of names for all ASCS + /// virtual machines to be deployed. The number of entries in this list + /// should be equal to the number VMs to be created for ASCS layer. At + /// maximum, there can be two virtual machines at this layer: ASCS and + /// ERS. + /// The full name for availability + /// set. In case name is not provided, it will be defaulted to + /// {SID}-ASCS-AvSet. + public CentralServerFullResourceNames(IList virtualMachines = default(IList), string availabilitySetName = default(string), LoadBalancerResourceNames loadBalancer = default(LoadBalancerResourceNames)) + { + VirtualMachines = virtualMachines; + AvailabilitySetName = availabilitySetName; + LoadBalancer = loadBalancer; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of names for all ASCS virtual machines to be + /// deployed. The number of entries in this list should be equal to the + /// number VMs to be created for ASCS layer. At maximum, there can be + /// two virtual machines at this layer: ASCS and ERS. + /// + [JsonProperty(PropertyName = "virtualMachines")] + public IList VirtualMachines { get; set; } + + /// + /// Gets or sets the full name for availability set. In case name is + /// not provided, it will be defaulted to {SID}-ASCS-AvSet. + /// + [JsonProperty(PropertyName = "availabilitySetName")] + public string AvailabilitySetName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "loadBalancer")] + public LoadBalancerResourceNames LoadBalancer { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (VirtualMachines != null) + { + if (VirtualMachines.Count > 2) + { + throw new ValidationException(ValidationRules.MaxItems, "VirtualMachines", 2); + } + foreach (var element in VirtualMachines) + { + if (element != null) + { + element.Validate(); + } + } + } + if (LoadBalancer != null) + { + LoadBalancer.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/CentralServerVirtualMachineType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/CentralServerVirtualMachineType.cs new file mode 100644 index 0000000000000..4340b6f4bd606 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/CentralServerVmDetails.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/CentralServerVmDetails.cs new file mode 100644 index 0000000000000..5aa14d30e5402 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/CentralServerVmDetails.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + 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' + /// Storage details of all the Storage + /// Accounts attached to the ASCS Virtual Machine. For e.g. NFS on AFS + /// Shared Storage. + public CentralServerVmDetails(string type = default(string), string virtualMachineId = default(string), IList storageDetails = default(IList)) + { + Type = type; + VirtualMachineId = virtualMachineId; + StorageDetails = storageDetails; + 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; } + + /// + /// Gets storage details of all the Storage Accounts attached to the + /// ASCS Virtual Machine. For e.g. NFS on AFS Shared Storage. + /// + [JsonProperty(PropertyName = "storageDetails")] + public IList StorageDetails { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ConfigurationType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ConfigurationType.cs new file mode 100644 index 0000000000000..48b5897a5bcbf --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ConfigurationType.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.SAPVirtualInstance.Models +{ + + /// + /// Defines values for ConfigurationType. + /// + public static class ConfigurationType + { + public const string Skip = "Skip"; + public const string CreateAndMount = "CreateAndMount"; + public const string Mount = "Mount"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/CreateAndMountFileShareConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/CreateAndMountFileShareConfiguration.cs new file mode 100644 index 0000000000000..ba973784adf4d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/CreateAndMountFileShareConfiguration.cs @@ -0,0 +1,73 @@ +// +// 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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the file share configuration where the transport directory + /// fileshare is created and mounted as a part of the create infra flow. + /// Please pre-create the resource group you intend to place the transport + /// directory in. The storage account and fileshare will be auto-created by + /// the ACSS and doesn't need to be pre-created. + /// + [Newtonsoft.Json.JsonObject("CreateAndMount")] + public partial class CreateAndMountFileShareConfiguration : FileShareConfiguration + { + /// + /// Initializes a new instance of the + /// CreateAndMountFileShareConfiguration class. + /// + public CreateAndMountFileShareConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CreateAndMountFileShareConfiguration class. + /// + /// The name of transport file share + /// resource group. This should be pre created by the customer. The app + /// rg is used in case of missing input. + /// The name of file share storage + /// account name . A custom name is used in case of missing + /// input. + public CreateAndMountFileShareConfiguration(string resourceGroup = default(string), string storageAccountName = default(string)) + { + ResourceGroup = resourceGroup; + StorageAccountName = storageAccountName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of transport file share resource group. This + /// should be pre created by the customer. The app rg is used in case + /// of missing input. + /// + [JsonProperty(PropertyName = "resourceGroup")] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the name of file share storage account name . A custom + /// name is used in case of missing input. + /// + [JsonProperty(PropertyName = "storageAccountName")] + public string StorageAccountName { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/CreatedByType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/CreatedByType.cs new file mode 100644 index 0000000000000..77933f936058f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/DatabaseConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DatabaseConfiguration.cs new file mode 100644 index 0000000000000..8f2bef4ab24f1 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DatabaseConfiguration.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.SAPVirtualInstance.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' + /// Gets or sets the disk + /// configuration. + public DatabaseConfiguration(string subnetId, VirtualMachineConfiguration virtualMachineConfiguration, long instanceCount, string databaseType = default(string), DiskConfiguration diskConfiguration = default(DiskConfiguration)) + { + DatabaseType = databaseType; + SubnetId = subnetId; + VirtualMachineConfiguration = virtualMachineConfiguration; + InstanceCount = instanceCount; + DiskConfiguration = diskConfiguration; + 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; } + + /// + /// Gets or sets the disk configuration. + /// + [JsonProperty(PropertyName = "diskConfiguration")] + public DiskConfiguration DiskConfiguration { 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.SAPVirtualInstance/src/Generated/Models/DatabaseServerFullResourceNames.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DatabaseServerFullResourceNames.cs new file mode 100644 index 0000000000000..e159edb1913e7 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DatabaseServerFullResourceNames.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.SAPVirtualInstance.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The full resource names object for database layer resources. The number + /// of entries in this list should be equal to the number VMs to be created + /// for database layer. + /// + public partial class DatabaseServerFullResourceNames + { + /// + /// Initializes a new instance of the DatabaseServerFullResourceNames + /// class. + /// + public DatabaseServerFullResourceNames() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseServerFullResourceNames + /// class. + /// + /// The list of virtual machine naming + /// details. + /// The full name for availability + /// set. In case name is not provided, it will be defaulted to + /// {SID}-DB-AvSet. + public DatabaseServerFullResourceNames(IList virtualMachines = default(IList), string availabilitySetName = default(string), LoadBalancerResourceNames loadBalancer = default(LoadBalancerResourceNames)) + { + VirtualMachines = virtualMachines; + AvailabilitySetName = availabilitySetName; + LoadBalancer = loadBalancer; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of virtual machine naming details. + /// + [JsonProperty(PropertyName = "virtualMachines")] + public IList VirtualMachines { get; set; } + + /// + /// Gets or sets the full name for availability set. In case name is + /// not provided, it will be defaulted to {SID}-DB-AvSet. + /// + [JsonProperty(PropertyName = "availabilitySetName")] + public string AvailabilitySetName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "loadBalancer")] + public LoadBalancerResourceNames LoadBalancer { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (VirtualMachines != null) + { + if (VirtualMachines.Count > 2) + { + throw new ValidationException(ValidationRules.MaxItems, "VirtualMachines", 2); + } + foreach (var element in VirtualMachines) + { + if (element != null) + { + element.Validate(); + } + } + } + if (LoadBalancer != null) + { + LoadBalancer.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DatabaseVmDetails.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DatabaseVmDetails.cs new file mode 100644 index 0000000000000..3134b279e8fb2 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DatabaseVmDetails.cs @@ -0,0 +1,73 @@ +// +// 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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + 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', 'SoftShutdown' + /// Storage details of all the Storage + /// Accounts attached to the Database Virtual Machine. For e.g. NFS on + /// AFS Shared Storage. + public DatabaseVmDetails(string virtualMachineId = default(string), string status = default(string), IList storageDetails = default(IList)) + { + VirtualMachineId = virtualMachineId; + Status = status; + StorageDetails = storageDetails; + 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', 'SoftShutdown' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets storage details of all the Storage Accounts attached to the + /// Database Virtual Machine. For e.g. NFS on AFS Shared Storage. + /// + [JsonProperty(PropertyName = "storageDetails")] + public IList StorageDetails { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DeployerVmPackages.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DeployerVmPackages.cs new file mode 100644 index 0000000000000..8a52272b1eee0 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/DeploymentConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DeploymentConfiguration.cs new file mode 100644 index 0000000000000..61794ccfd0b18 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/DeploymentWithOSConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DeploymentWithOSConfiguration.cs new file mode 100644 index 0000000000000..b43a88a229ec5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/DiscoveryConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiscoveryConfiguration.cs new file mode 100644 index 0000000000000..816e8d5579ed0 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiscoveryConfiguration.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.SAPVirtualInstance.Models +{ + using Microsoft.Rest; + 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 custom storage + /// account name for the storage account created by the service in the + /// managed resource group created as part of VIS + /// deployment.<br><br>Refer to the storage account naming + /// rules + /// [here](https://learn.microsoft.com/azure/azure-resource-manager/management/resource-name-rules#microsoftstorage).<br><br>If + /// not provided, the service will create the storage account with a + /// random name. + /// The geo-location where the SAP system + /// exists. + public DiscoveryConfiguration(string centralServerVmId = default(string), string managedRgStorageAccountName = default(string), string appLocation = default(string)) + { + CentralServerVmId = centralServerVmId; + ManagedRgStorageAccountName = managedRgStorageAccountName; + 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 or sets the custom storage account name for the storage + /// account created by the service in the managed resource group + /// created as part of VIS + /// deployment.&lt;br&gt;&lt;br&gt;Refer to the storage + /// account naming rules + /// [here](https://learn.microsoft.com/azure/azure-resource-manager/management/resource-name-rules#microsoftstorage).&lt;br&gt;&lt;br&gt;If + /// not provided, the service will create the storage account with a + /// random name. + /// + [JsonProperty(PropertyName = "managedRgStorageAccountName")] + public string ManagedRgStorageAccountName { get; set; } + + /// + /// Gets the geo-location where the SAP system exists. + /// + [JsonProperty(PropertyName = "appLocation")] + public string AppLocation { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ManagedRgStorageAccountName != null) + { + if (ManagedRgStorageAccountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "ManagedRgStorageAccountName", 24); + } + if (ManagedRgStorageAccountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "ManagedRgStorageAccountName", 3); + } + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiskConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiskConfiguration.cs new file mode 100644 index 0000000000000..92687ee1d3663 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiskConfiguration.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Disk Configuration Details. + /// + public partial class DiskConfiguration + { + /// + /// Initializes a new instance of the DiskConfiguration class. + /// + public DiskConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskConfiguration class. + /// + /// The disk configuration for + /// the db volume. For HANA, Required volumes are: ['hana/data', + /// 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : + /// ['backup']. + public DiskConfiguration(IDictionary diskVolumeConfigurations = default(IDictionary)) + { + DiskVolumeConfigurations = diskVolumeConfigurations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the disk configuration for the db volume. For HANA, + /// Required volumes are: ['hana/data', 'hana/log', hana/shared', + /// 'usr/sap', 'os'], Optional volume : ['backup']. + /// + [JsonProperty(PropertyName = "diskVolumeConfigurations")] + public IDictionary DiskVolumeConfigurations { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiskDetails.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiskDetails.cs new file mode 100644 index 0000000000000..7e39b89d66b21 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiskDetails.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The supported disk size details for a disk type. + /// + public partial class DiskDetails + { + /// + /// Initializes a new instance of the DiskDetails class. + /// + public DiskDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskDetails class. + /// + /// The disk size in GB. + /// The minimum supported disk + /// count. + /// The maximum supported disk + /// count. + /// The disk Iops. + /// The disk provisioned throughput in + /// MBps. + /// The disk tier, e.g. P10, E10. + public DiskDetails(DiskSku sku = default(DiskSku), long? sizeGB = default(long?), long? minimumSupportedDiskCount = default(long?), long? maximumSupportedDiskCount = default(long?), long? iopsReadWrite = default(long?), long? mbpsReadWrite = default(long?), string diskTier = default(string)) + { + Sku = sku; + SizeGB = sizeGB; + MinimumSupportedDiskCount = minimumSupportedDiskCount; + MaximumSupportedDiskCount = maximumSupportedDiskCount; + IopsReadWrite = iopsReadWrite; + MbpsReadWrite = mbpsReadWrite; + DiskTier = diskTier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "sku")] + public DiskSku Sku { get; set; } + + /// + /// Gets or sets the disk size in GB. + /// + [JsonProperty(PropertyName = "sizeGB")] + public long? SizeGB { get; set; } + + /// + /// Gets or sets the minimum supported disk count. + /// + [JsonProperty(PropertyName = "minimumSupportedDiskCount")] + public long? MinimumSupportedDiskCount { get; set; } + + /// + /// Gets or sets the maximum supported disk count. + /// + [JsonProperty(PropertyName = "maximumSupportedDiskCount")] + public long? MaximumSupportedDiskCount { get; set; } + + /// + /// Gets or sets the disk Iops. + /// + [JsonProperty(PropertyName = "iopsReadWrite")] + public long? IopsReadWrite { get; set; } + + /// + /// Gets or sets the disk provisioned throughput in MBps. + /// + [JsonProperty(PropertyName = "mbpsReadWrite")] + public long? MbpsReadWrite { get; set; } + + /// + /// Gets or sets the disk tier, e.g. P10, E10. + /// + [JsonProperty(PropertyName = "diskTier")] + public string DiskTier { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiskSku.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiskSku.cs new file mode 100644 index 0000000000000..e82c201b61fda --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiskSku.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The type of disk sku. For example, Standard_LRS, Standard_ZRS, + /// Premium_LRS, Premium_ZRS. + /// + public partial class DiskSku + { + /// + /// Initializes a new instance of the DiskSku class. + /// + public DiskSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskSku class. + /// + /// Possible values include: 'Standard_LRS', + /// 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS', 'Premium_ZRS', + /// 'StandardSSD_ZRS', 'PremiumV2_LRS' + public DiskSku(string name = default(string)) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'Standard_LRS', + /// 'Premium_LRS', 'StandardSSD_LRS', 'UltraSSD_LRS', 'Premium_ZRS', + /// 'StandardSSD_ZRS', 'PremiumV2_LRS' + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiskSkuName.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiskSkuName.cs new file mode 100644 index 0000000000000..62d254b7a1255 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiskSkuName.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.SAPVirtualInstance.Models +{ + + /// + /// Defines values for DiskSkuName. + /// + public static class DiskSkuName + { + public const string StandardLRS = "Standard_LRS"; + public const string PremiumLRS = "Premium_LRS"; + public const string StandardSSDLRS = "StandardSSD_LRS"; + public const string UltraSSDLRS = "UltraSSD_LRS"; + public const string PremiumZRS = "Premium_ZRS"; + public const string StandardSSDZRS = "StandardSSD_ZRS"; + public const string PremiumV2LRS = "PremiumV2_LRS"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiskVolumeConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiskVolumeConfiguration.cs new file mode 100644 index 0000000000000..773627e4e3d87 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/DiskVolumeConfiguration.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The disk configuration required for the selected volume. + /// + public partial class DiskVolumeConfiguration + { + /// + /// Initializes a new instance of the DiskVolumeConfiguration class. + /// + public DiskVolumeConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskVolumeConfiguration class. + /// + /// The total number of disks required for the + /// concerned volume. + /// The disk size in GB. + /// The disk SKU details. + public DiskVolumeConfiguration(long? count = default(long?), long? sizeGB = default(long?), DiskSku sku = default(DiskSku)) + { + Count = count; + SizeGB = sizeGB; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the total number of disks required for the concerned + /// volume. + /// + [JsonProperty(PropertyName = "count")] + public long? Count { get; set; } + + /// + /// Gets or sets the disk size in GB. + /// + [JsonProperty(PropertyName = "sizeGB")] + public long? SizeGB { get; set; } + + /// + /// Gets or sets the disk SKU details. + /// + [JsonProperty(PropertyName = "sku")] + public DiskSku Sku { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/EnqueueReplicationServerProperties.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/EnqueueReplicationServerProperties.cs new file mode 100644 index 0000000000000..4a980a045c544 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/EnqueueReplicationServerType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/EnqueueReplicationServerType.cs new file mode 100644 index 0000000000000..faf728193fcb4 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/EnqueueServerProperties.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/EnqueueServerProperties.cs new file mode 100644 index 0000000000000..61a1c74055647 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 0000000000000..fdacd4d0b73bf --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ErrorDefinition.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ErrorDefinition.cs new file mode 100644 index 0000000000000..cdcafaa0b4efa --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ErrorDetail.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 0000000000000..786b673d615de --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ErrorResponse.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 0000000000000..4f8132ed72bbd --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ErrorResponseException.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 0000000000000..f8af5a320a57e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ExternalInstallationSoftwareConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ExternalInstallationSoftwareConfiguration.cs new file mode 100644 index 0000000000000..429758e329207 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/FileShareConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/FileShareConfiguration.cs new file mode 100644 index 0000000000000..c746499b4a85c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/FileShareConfiguration.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.SAPVirtualInstance.Models +{ + using System.Linq; + + /// + /// File Share configuration details, populated with information on storage + /// configuration mounted on the VIS. The createAndMount option is selected + /// in case of missing input. + /// + public partial class FileShareConfiguration + { + /// + /// Initializes a new instance of the FileShareConfiguration class. + /// + public FileShareConfiguration() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/GatewayServerProperties.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/GatewayServerProperties.cs new file mode 100644 index 0000000000000..590ebf3485e95 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/HighAvailabilityConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/HighAvailabilityConfiguration.cs new file mode 100644 index 0000000000000..8ce3536937559 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/HighAvailabilitySoftwareConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/HighAvailabilitySoftwareConfiguration.cs new file mode 100644 index 0000000000000..0d0f195990bf5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/Identity.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/Identity.cs new file mode 100644 index 0000000000000..cd5ff44ce987c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ImageReference.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ImageReference.cs new file mode 100644 index 0000000000000..8f5cf42570f9b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ImageReference.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.SAPVirtualInstance.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 the ARM resource ID of the Azure Compute + /// Gallery image version used for creating ACSS VMs. You will need to + /// provide this input when you choose to deploy virtual machines in + /// ACSS with OS image from the Azure Compute gallery. + public ImageReference(string publisher = default(string), string offer = default(string), string sku = default(string), string version = default(string), string id = default(string)) + { + Publisher = publisher; + Offer = offer; + Sku = sku; + Version = version; + Id = id; + 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 or sets specifies the ARM resource ID of the Azure Compute + /// Gallery image version used for creating ACSS VMs. You will need to + /// provide this input when you choose to deploy virtual machines in + /// ACSS with OS image from the Azure Compute gallery. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/InfrastructureConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/InfrastructureConfiguration.cs new file mode 100644 index 0000000000000..aaa313aff8a4c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/LinuxConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/LinuxConfiguration.cs new file mode 100644 index 0000000000000..ea247b2670ac5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/LoadBalancerDetails.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/LoadBalancerDetails.cs new file mode 100644 index 0000000000000..8e90e97157789 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/LoadBalancerDetails.cs @@ -0,0 +1,49 @@ +// +// 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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Load Balancer details such as Load Balancer ID. + /// + public partial class LoadBalancerDetails + { + /// + /// Initializes a new instance of the LoadBalancerDetails class. + /// + public LoadBalancerDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LoadBalancerDetails class. + /// + public LoadBalancerDetails(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/LoadBalancerResourceNames.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/LoadBalancerResourceNames.cs new file mode 100644 index 0000000000000..2f571ca38c98c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/LoadBalancerResourceNames.cs @@ -0,0 +1,124 @@ +// +// 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.SAPVirtualInstance.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource names object for load balancer and related resources. + /// + public partial class LoadBalancerResourceNames + { + /// + /// Initializes a new instance of the LoadBalancerResourceNames class. + /// + public LoadBalancerResourceNames() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LoadBalancerResourceNames class. + /// + /// The full resource name for load + /// balancer. If this value is not provided, load balancer will be name + /// as {ASCS/DB}-loadBalancer. + /// The list of frontend IP + /// configuration names. If provided as input, size of this list should + /// be 2 for cs layer and should be 1 for database layer. + /// The list of backend pool names. + /// Currently, ACSS deploys only one backend pool and hence, size of + /// this list should be 1 + /// The list of health probe names. If + /// provided as input, size of this list should be 2 for cs layer and + /// should be 1 for database layer. + public LoadBalancerResourceNames(string loadBalancerName = default(string), IList frontendIpConfigurationNames = default(IList), IList backendPoolNames = default(IList), IList healthProbeNames = default(IList)) + { + LoadBalancerName = loadBalancerName; + FrontendIpConfigurationNames = frontendIpConfigurationNames; + BackendPoolNames = backendPoolNames; + HealthProbeNames = healthProbeNames; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the full resource name for load balancer. If this + /// value is not provided, load balancer will be name as + /// {ASCS/DB}-loadBalancer. + /// + [JsonProperty(PropertyName = "loadBalancerName")] + public string LoadBalancerName { get; set; } + + /// + /// Gets or sets the list of frontend IP configuration names. If + /// provided as input, size of this list should be 2 for cs layer and + /// should be 1 for database layer. + /// + [JsonProperty(PropertyName = "frontendIpConfigurationNames")] + public IList FrontendIpConfigurationNames { get; set; } + + /// + /// Gets or sets the list of backend pool names. Currently, ACSS + /// deploys only one backend pool and hence, size of this list should + /// be 1 + /// + [JsonProperty(PropertyName = "backendPoolNames")] + public IList BackendPoolNames { get; set; } + + /// + /// Gets or sets the list of health probe names. If provided as input, + /// size of this list should be 2 for cs layer and should be 1 for + /// database layer. + /// + [JsonProperty(PropertyName = "healthProbeNames")] + public IList HealthProbeNames { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (FrontendIpConfigurationNames != null) + { + if (FrontendIpConfigurationNames.Count > 2) + { + throw new ValidationException(ValidationRules.MaxItems, "FrontendIpConfigurationNames", 2); + } + } + if (BackendPoolNames != null) + { + if (BackendPoolNames.Count > 1) + { + throw new ValidationException(ValidationRules.MaxItems, "BackendPoolNames", 1); + } + } + if (HealthProbeNames != null) + { + if (HealthProbeNames.Count > 2) + { + throw new ValidationException(ValidationRules.MaxItems, "HealthProbeNames", 2); + } + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ManagedRGConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ManagedRGConfiguration.cs new file mode 100644 index 0000000000000..f1f1555bd4e5b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ManagedResourcesNetworkAccessType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ManagedResourcesNetworkAccessType.cs new file mode 100644 index 0000000000000..abaee111be611 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ManagedResourcesNetworkAccessType.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.SAPVirtualInstance.Models +{ + + /// + /// Defines values for ManagedResourcesNetworkAccessType. + /// + public static class ManagedResourcesNetworkAccessType + { + public const string Public = "Public"; + public const string Private = "Private"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ManagedServiceIdentityType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ManagedServiceIdentityType.cs new file mode 100644 index 0000000000000..5aa4a7c97e4f5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/MessageServerProperties.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/MessageServerProperties.cs new file mode 100644 index 0000000000000..3a8c66a4f968f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/MountFileShareConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/MountFileShareConfiguration.cs new file mode 100644 index 0000000000000..acd3d69a22625 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/MountFileShareConfiguration.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.SAPVirtualInstance.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the file share configuration where the transport directory + /// fileshare already exists, and user wishes to mount the fileshare as a + /// part of the create infra flow. + /// + [Newtonsoft.Json.JsonObject("Mount")] + public partial class MountFileShareConfiguration : FileShareConfiguration + { + /// + /// Initializes a new instance of the MountFileShareConfiguration + /// class. + /// + public MountFileShareConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MountFileShareConfiguration + /// class. + /// + /// The fileshare resource ID + /// The private endpoint resource + /// ID + public MountFileShareConfiguration(string id, string privateEndpointId) + { + Id = id; + PrivateEndpointId = privateEndpointId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the fileshare resource ID + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the private endpoint resource ID + /// + [JsonProperty(PropertyName = "privateEndpointId")] + public string PrivateEndpointId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + if (PrivateEndpointId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrivateEndpointId"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/NamingPatternType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/NamingPatternType.cs new file mode 100644 index 0000000000000..038b7fbd7445b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/NamingPatternType.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.SAPVirtualInstance.Models +{ + + /// + /// Defines values for NamingPatternType. + /// + public static class NamingPatternType + { + public const string FullResourceName = "FullResourceName"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/NetworkConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/NetworkConfiguration.cs new file mode 100644 index 0000000000000..6c1baf1cf89a2 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/NetworkInterfaceResourceNames.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/NetworkInterfaceResourceNames.cs new file mode 100644 index 0000000000000..d35b87c3f2802 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/NetworkInterfaceResourceNames.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource names object for network interface and related resources. + /// + public partial class NetworkInterfaceResourceNames + { + /// + /// Initializes a new instance of the NetworkInterfaceResourceNames + /// class. + /// + public NetworkInterfaceResourceNames() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkInterfaceResourceNames + /// class. + /// + /// The full name for network + /// interface. If name is not provided, service uses a default name + /// based on the deployment type. For SingleServer, default name is + /// {SID}-Nic. In case of HA-AvZone systems, default name will be + /// {SID}-{App/ASCS/DB}-Zone{A/B}-Nic with an incrementor at the end in + /// case of more than 1 instance per layer. For distributed and + /// HA-AvSet systems, default name will be {SID}-{App/ASCS/DB}-Nic with + /// an incrementor at the end in case of more than 1 instance per + /// layer. + public NetworkInterfaceResourceNames(string networkInterfaceName = default(string)) + { + NetworkInterfaceName = networkInterfaceName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the full name for network interface. If name is not + /// provided, service uses a default name based on the deployment type. + /// For SingleServer, default name is {SID}-Nic. In case of HA-AvZone + /// systems, default name will be {SID}-{App/ASCS/DB}-Zone{A/B}-Nic + /// with an incrementor at the end in case of more than 1 instance per + /// layer. For distributed and HA-AvSet systems, default name will be + /// {SID}-{App/ASCS/DB}-Nic with an incrementor at the end in case of + /// more than 1 instance per layer. + /// + [JsonProperty(PropertyName = "networkInterfaceName")] + public string NetworkInterfaceName { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/OSConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/OSConfiguration.cs new file mode 100644 index 0000000000000..4504d9ab57859 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/OSProfile.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/OSProfile.cs new file mode 100644 index 0000000000000..47570f61a30e8 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/Operation.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/Operation.cs new file mode 100644 index 0000000000000..b8142da81129d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/OperationDisplay.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 0000000000000..3a516b98bedb4 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/OperationStatusResult.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/OperationStatusResult.cs new file mode 100644 index 0000000000000..0d32d7c71ca6c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/Origin.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/Origin.cs new file mode 100644 index 0000000000000..adcda0fa26e17 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/OsSapConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/OsSapConfiguration.cs new file mode 100644 index 0000000000000..785fc48ee0fb6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/Page.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/Page.cs new file mode 100644 index 0000000000000..8ab03eed3d12d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/Plan.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/Plan.cs new file mode 100644 index 0000000000000..4b78bb1b6dcd8 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ProxyResource.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ProxyResource.cs new file mode 100644 index 0000000000000..a8d892f97a292 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/Resource.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/Resource.cs new file mode 100644 index 0000000000000..5fb177657a4eb --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ResourceIdentityType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 0000000000000..1335ea7c5c3dc --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ResourceModelWithAllowedPropertySet.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ResourceModelWithAllowedPropertySet.cs new file mode 100644 index 0000000000000..d0a0e24c2a0d3 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs new file mode 100644 index 0000000000000..2041e1bebf2c2 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs new file mode 100644 index 0000000000000..b594aa3d6dc66 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs new file mode 100644 index 0000000000000..a35604b758697 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPApplicationServerInstance.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPApplicationServerInstance.cs new file mode 100644 index 0000000000000..47de8d8b4cc22 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPApplicationServerInstance.cs @@ -0,0 +1,221 @@ +// +// 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.SAPVirtualInstance.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. + /// Application server instance + /// dispatcher status. + /// The Load Balancer details such as + /// LoadBalancer ID attached to Application Server Virtual + /// Machines + /// The list of virtual machines. + /// Possible values include: 'Starting', + /// 'Running', 'Stopping', 'Offline', 'PartiallyRunning', + /// 'Unavailable', 'SoftShutdown' + /// Possible values include: 'Unknown', 'Healthy', + /// 'Unhealthy', 'Degraded' + /// Possible values include: + /// 'Succeeded', 'Updating', 'Creating', 'Failed', 'Deleting', + /// 'Canceled' + /// 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 dispatcherStatus = default(string), LoadBalancerDetails loadBalancerDetails = default(LoadBalancerDetails), 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; + Hostname = hostname; + KernelVersion = kernelVersion; + KernelPatch = kernelPatch; + IpAddress = ipAddress; + GatewayPort = gatewayPort; + IcmHttpPort = icmHttpPort; + IcmHttpsPort = icmHttpsPort; + DispatcherStatus = dispatcherStatus; + LoadBalancerDetails = loadBalancerDetails; + 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 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 application server instance dispatcher status. + /// + [JsonProperty(PropertyName = "properties.dispatcherStatus")] + public string DispatcherStatus { get; private set; } + + /// + /// Gets the Load Balancer details such as LoadBalancer ID attached to + /// Application Server Virtual Machines + /// + [JsonProperty(PropertyName = "properties.loadBalancerDetails")] + public LoadBalancerDetails LoadBalancerDetails { get; private set; } + + /// + /// Gets the list of virtual machines. + /// + [JsonProperty(PropertyName = "properties.vmDetails")] + public IList VmDetails { get; private set; } + + /// + /// Gets possible values include: 'Starting', 'Running', 'Stopping', + /// 'Offline', 'PartiallyRunning', 'Unavailable', 'SoftShutdown' + /// + [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', 'Canceled' + /// + [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.SAPVirtualInstance/src/Generated/Models/SAPApplicationServerInstancesDeleteHeaders.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPApplicationServerInstancesDeleteHeaders.cs new file mode 100644 index 0000000000000..712635cae2fa7 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPApplicationServerInstancesDeleteHeaders.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class SAPApplicationServerInstancesDeleteHeaders + { + /// + /// Initializes a new instance of the + /// SAPApplicationServerInstancesDeleteHeaders class. + /// + public SAPApplicationServerInstancesDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SAPApplicationServerInstancesDeleteHeaders class. + /// + /// The URI to fetch the updated SAP Application + /// Server Instance resource. + public SAPApplicationServerInstancesDeleteHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URI to fetch the updated SAP Application Server + /// Instance resource. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPApplicationServerInstancesStartInstanceHeaders.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPApplicationServerInstancesStartInstanceHeaders.cs new file mode 100644 index 0000000000000..afb0970c443da --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPApplicationServerInstancesStartInstanceHeaders.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for StartInstance operation. + /// + public partial class SAPApplicationServerInstancesStartInstanceHeaders + { + /// + /// Initializes a new instance of the + /// SAPApplicationServerInstancesStartInstanceHeaders class. + /// + public SAPApplicationServerInstancesStartInstanceHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SAPApplicationServerInstancesStartInstanceHeaders class. + /// + /// The URI to fetch the updated Virtual + /// Instance for SAP resource. + public SAPApplicationServerInstancesStartInstanceHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URI to fetch the updated Virtual Instance for SAP + /// resource. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPApplicationServerInstancesStopInstanceHeaders.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPApplicationServerInstancesStopInstanceHeaders.cs new file mode 100644 index 0000000000000..b0ec7344f1965 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPApplicationServerInstancesStopInstanceHeaders.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for StopInstance operation. + /// + public partial class SAPApplicationServerInstancesStopInstanceHeaders + { + /// + /// Initializes a new instance of the + /// SAPApplicationServerInstancesStopInstanceHeaders class. + /// + public SAPApplicationServerInstancesStopInstanceHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SAPApplicationServerInstancesStopInstanceHeaders class. + /// + /// The URI to fetch the updated Virtual + /// Instance for SAP resource. + public SAPApplicationServerInstancesStopInstanceHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URI to fetch the updated Virtual Instance for SAP + /// resource. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPAvailabilityZoneDetailsRequest.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPAvailabilityZoneDetailsRequest.cs new file mode 100644 index 0000000000000..623286f0a2228 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPAvailabilityZoneDetailsResult.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPAvailabilityZoneDetailsResult.cs new file mode 100644 index 0000000000000..43c3a6b3a0491 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPAvailabilityZonePair.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPAvailabilityZonePair.cs new file mode 100644 index 0000000000000..e2184a65543a3 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPCentralInstancesDeleteHeaders.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPCentralInstancesDeleteHeaders.cs new file mode 100644 index 0000000000000..89cda1c7863b7 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPCentralInstancesDeleteHeaders.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class SAPCentralInstancesDeleteHeaders + { + /// + /// Initializes a new instance of the SAPCentralInstancesDeleteHeaders + /// class. + /// + public SAPCentralInstancesDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPCentralInstancesDeleteHeaders + /// class. + /// + /// The URI to fetch the updated SAP Central + /// Services Instance resource. + public SAPCentralInstancesDeleteHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URI to fetch the updated SAP Central Services + /// Instance resource. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPCentralInstancesStartInstanceHeaders.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPCentralInstancesStartInstanceHeaders.cs new file mode 100644 index 0000000000000..39c04ee3e46ff --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPCentralInstancesStartInstanceHeaders.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for StartInstance operation. + /// + public partial class SAPCentralInstancesStartInstanceHeaders + { + /// + /// Initializes a new instance of the + /// SAPCentralInstancesStartInstanceHeaders class. + /// + public SAPCentralInstancesStartInstanceHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SAPCentralInstancesStartInstanceHeaders class. + /// + /// The URI to fetch the updated central + /// instance for SAP resource. + public SAPCentralInstancesStartInstanceHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URI to fetch the updated central instance for SAP + /// resource. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPCentralInstancesStopInstanceHeaders.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPCentralInstancesStopInstanceHeaders.cs new file mode 100644 index 0000000000000..da36483271b53 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPCentralInstancesStopInstanceHeaders.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for StopInstance operation. + /// + public partial class SAPCentralInstancesStopInstanceHeaders + { + /// + /// Initializes a new instance of the + /// SAPCentralInstancesStopInstanceHeaders class. + /// + public SAPCentralInstancesStopInstanceHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SAPCentralInstancesStopInstanceHeaders class. + /// + /// The URI to fetch the updated Virtual + /// Instance for SAP resource. + public SAPCentralInstancesStopInstanceHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URI to fetch the updated Virtual Instance for SAP + /// resource. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPCentralServerInstance.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPCentralServerInstance.cs new file mode 100644 index 0000000000000..6272b6b85080c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPCentralServerInstance.cs @@ -0,0 +1,191 @@ +// +// 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.SAPVirtualInstance.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 Load Balancer details such as + /// LoadBalancer ID attached to ASCS Virtual Machines + /// The list of virtual machines corresponding + /// to the Central Services instance. + /// Possible values include: 'Starting', + /// 'Running', 'Stopping', 'Offline', 'PartiallyRunning', + /// 'Unavailable', 'SoftShutdown' + /// Possible values include: 'Unknown', 'Healthy', + /// 'Unhealthy', 'Degraded' + /// Possible values include: + /// 'Succeeded', 'Updating', 'Creating', 'Failed', 'Deleting', + /// 'Canceled' + /// 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), LoadBalancerDetails loadBalancerDetails = default(LoadBalancerDetails), 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; + LoadBalancerDetails = loadBalancerDetails; + 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 Load Balancer details such as LoadBalancer ID attached to + /// ASCS Virtual Machines + /// + [JsonProperty(PropertyName = "properties.loadBalancerDetails")] + public LoadBalancerDetails LoadBalancerDetails { 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', 'SoftShutdown' + /// + [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', 'Canceled' + /// + [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.SAPVirtualInstance/src/Generated/Models/SAPConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPConfiguration.cs new file mode 100644 index 0000000000000..11cc7ecaea561 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPConfigurationType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPConfigurationType.cs new file mode 100644 index 0000000000000..a7629cf20e2d6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPDatabaseInstance.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDatabaseInstance.cs new file mode 100644 index 0000000000000..6c321b982a340 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDatabaseInstance.cs @@ -0,0 +1,155 @@ +// +// 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.SAPVirtualInstance.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 Load Balancer details such as + /// LoadBalancer ID attached to Database Virtual Machines + /// The list of virtual machines corresponding + /// to the Database resource. + /// Possible values include: 'Starting', + /// 'Running', 'Stopping', 'Offline', 'PartiallyRunning', + /// 'Unavailable', 'SoftShutdown' + /// Possible values include: + /// 'Succeeded', 'Updating', 'Creating', 'Failed', 'Deleting', + /// 'Canceled' + /// 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), LoadBalancerDetails loadBalancerDetails = default(LoadBalancerDetails), 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; + LoadBalancerDetails = loadBalancerDetails; + 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 Load Balancer details such as LoadBalancer ID attached to + /// Database Virtual Machines + /// + [JsonProperty(PropertyName = "properties.loadBalancerDetails")] + public LoadBalancerDetails LoadBalancerDetails { 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', 'SoftShutdown' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets possible values include: 'Succeeded', 'Updating', 'Creating', + /// 'Failed', 'Deleting', 'Canceled' + /// + [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.SAPVirtualInstance/src/Generated/Models/SAPDatabaseInstancesDeleteHeaders.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDatabaseInstancesDeleteHeaders.cs new file mode 100644 index 0000000000000..999ef6360f175 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDatabaseInstancesDeleteHeaders.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class SAPDatabaseInstancesDeleteHeaders + { + /// + /// Initializes a new instance of the SAPDatabaseInstancesDeleteHeaders + /// class. + /// + public SAPDatabaseInstancesDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPDatabaseInstancesDeleteHeaders + /// class. + /// + /// The URI to fetch the updated SAP Database + /// Instance resource. + public SAPDatabaseInstancesDeleteHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URI to fetch the updated SAP Database Instance + /// resource. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDatabaseInstancesStartInstanceHeaders.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDatabaseInstancesStartInstanceHeaders.cs new file mode 100644 index 0000000000000..b1a28e6991fd5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDatabaseInstancesStartInstanceHeaders.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for StartInstance operation. + /// + public partial class SAPDatabaseInstancesStartInstanceHeaders + { + /// + /// Initializes a new instance of the + /// SAPDatabaseInstancesStartInstanceHeaders class. + /// + public SAPDatabaseInstancesStartInstanceHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SAPDatabaseInstancesStartInstanceHeaders class. + /// + /// The URI to fetch the updated Virtual + /// Instance for SAP resource. + public SAPDatabaseInstancesStartInstanceHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URI to fetch the updated Virtual Instance for SAP + /// resource. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDatabaseInstancesStopInstanceHeaders.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDatabaseInstancesStopInstanceHeaders.cs new file mode 100644 index 0000000000000..d54d0c78721d5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDatabaseInstancesStopInstanceHeaders.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for StopInstance operation. + /// + public partial class SAPDatabaseInstancesStopInstanceHeaders + { + /// + /// Initializes a new instance of the + /// SAPDatabaseInstancesStopInstanceHeaders class. + /// + public SAPDatabaseInstancesStopInstanceHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SAPDatabaseInstancesStopInstanceHeaders class. + /// + /// The URI to fetch the updated Virtual + /// Instance for SAP resource. + public SAPDatabaseInstancesStopInstanceHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URI to fetch the updated Virtual Instance for SAP + /// resource. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDatabaseScaleMethod.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDatabaseScaleMethod.cs new file mode 100644 index 0000000000000..39bfcf8b725b5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.Models +{ + + /// + /// Defines values for SAPDatabaseScaleMethod. + /// + public static class SAPDatabaseScaleMethod + { + public const string ScaleUp = "ScaleUp"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDatabaseType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDatabaseType.cs new file mode 100644 index 0000000000000..36334ddc7878f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPDeploymentType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDeploymentType.cs new file mode 100644 index 0000000000000..c679987795b61 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPDiskConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDiskConfiguration.cs new file mode 100644 index 0000000000000..d259876fa6cda --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDiskConfiguration.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The SAP Disk Configuration contains 'recommended disk' details and list + /// of supported disks detail for a volume type. + /// + public partial class SAPDiskConfiguration + { + /// + /// Initializes a new instance of the SAPDiskConfiguration class. + /// + public SAPDiskConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPDiskConfiguration class. + /// + /// The recommended disk details + /// for a given VM Sku. + /// The list of supported disks + /// for a given VM Sku. + public SAPDiskConfiguration(DiskVolumeConfiguration recommendedConfiguration = default(DiskVolumeConfiguration), IList supportedConfigurations = default(IList)) + { + RecommendedConfiguration = recommendedConfiguration; + SupportedConfigurations = supportedConfigurations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the recommended disk details for a given VM Sku. + /// + [JsonProperty(PropertyName = "recommendedConfiguration")] + public DiskVolumeConfiguration RecommendedConfiguration { get; set; } + + /// + /// Gets or sets the list of supported disks for a given VM Sku. + /// + [JsonProperty(PropertyName = "supportedConfigurations")] + public IList SupportedConfigurations { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDiskConfigurationsRequest.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDiskConfigurationsRequest.cs new file mode 100644 index 0000000000000..3b05181583eef --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPDiskConfigurationsResult.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDiskConfigurationsResult.cs new file mode 100644 index 0000000000000..5fd659052d5ef --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPDiskConfigurationsResult.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.SAPVirtualInstance.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. + /// + /// The disk configuration for the + /// db volume. For HANA, Required volumes are: ['hana/data', + /// 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : + /// ['backup']. + public SAPDiskConfigurationsResult(IDictionary volumeConfigurations = default(IDictionary)) + { + VolumeConfigurations = volumeConfigurations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the disk configuration for the db volume. For HANA, + /// Required volumes are: ['hana/data', 'hana/log', hana/shared', + /// 'usr/sap', 'os'], Optional volume : ['backup']. + /// + [JsonProperty(PropertyName = "volumeConfigurations")] + public IDictionary VolumeConfigurations { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPEnvironmentType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPEnvironmentType.cs new file mode 100644 index 0000000000000..5c5f7360cb010 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPHealthState.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPHealthState.cs new file mode 100644 index 0000000000000..3a472dc22c03c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPHighAvailabilityType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPHighAvailabilityType.cs new file mode 100644 index 0000000000000..ae50073a9002f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPInstallWithoutOSConfigSoftwareConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPInstallWithoutOSConfigSoftwareConfiguration.cs new file mode 100644 index 0000000000000..9611fb0871087 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPProductType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPProductType.cs new file mode 100644 index 0000000000000..3ce88de78da8b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPSizingRecommendationRequest.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPSizingRecommendationRequest.cs new file mode 100644 index 0000000000000..9a6d8d32596ea --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPSizingRecommendationResult.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPSizingRecommendationResult.cs new file mode 100644 index 0000000000000..e34bd833981d8 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPSoftwareInstallationType.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPSoftwareInstallationType.cs new file mode 100644 index 0000000000000..267aaacd34254 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPSupportedResourceSkusResult.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPSupportedResourceSkusResult.cs new file mode 100644 index 0000000000000..5ca85ce74ccc6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPSupportedSku.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPSupportedSku.cs new file mode 100644 index 0000000000000..80da81d731d37 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPSupportedSkusRequest.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPSupportedSkusRequest.cs new file mode 100644 index 0000000000000..da57cab5919d7 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstanceError.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstanceError.cs new file mode 100644 index 0000000000000..4cea10006fdb9 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstanceModel.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstanceModel.cs new file mode 100644 index 0000000000000..9543d8be550e7 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstanceModel.cs @@ -0,0 +1,220 @@ +// +// 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.SAPVirtualInstance.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 SAPVirtualInstanceModel : TrackedResource + { + /// + /// Initializes a new instance of the SAPVirtualInstanceModel class. + /// + public SAPVirtualInstanceModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPVirtualInstanceModel 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. + /// Specifies the + /// network access configuration for the resources that will be + /// deployed in the Managed Resource Group. The options to choose from + /// are Public and Private. If 'Private' is chosen, the Storage Account + /// service tag should be enabled on the subnets in which the SAP VMs + /// exist. This is required for establishing connectivity between VM + /// extensions and the managed resource group storage account. This + /// setting is currently applicable only to Storage Account. Learn more + /// here https://go.microsoft.com/fwlink/?linkid=2247228. Possible + /// values include: 'Public', 'Private' + /// Managed resource + /// group configuration + /// Possible values include: 'Starting', + /// 'Running', 'Stopping', 'Offline', 'PartiallyRunning', + /// 'Unavailable', 'SoftShutdown' + /// Possible values include: 'Unknown', 'Healthy', + /// 'Unhealthy', 'Degraded' + /// Possible values include: + /// 'InfrastructureDeploymentPending', + /// 'InfrastructureDeploymentInProgress', + /// 'InfrastructureDeploymentFailed', 'SoftwareInstallationPending', + /// 'SoftwareInstallationInProgress', 'SoftwareInstallationFailed', + /// 'SoftwareDetectionInProgress', 'SoftwareDetectionFailed', + /// 'DiscoveryPending', 'DiscoveryInProgress', 'DiscoveryFailed', + /// 'RegistrationComplete', 'ACSSInstallationBlocked' + /// Possible values include: + /// 'Succeeded', 'Updating', 'Creating', 'Failed', 'Deleting', + /// 'Canceled' + /// Indicates any errors on the Virtual Instance + /// for SAP solutions resource. + public SAPVirtualInstanceModel(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), string managedResourcesNetworkAccessType = default(string), 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; + ManagedResourcesNetworkAccessType = managedResourcesNetworkAccessType; + 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 specifies the network access configuration for the + /// resources that will be deployed in the Managed Resource Group. The + /// options to choose from are Public and Private. If 'Private' is + /// chosen, the Storage Account service tag should be enabled on the + /// subnets in which the SAP VMs exist. This is required for + /// establishing connectivity between VM extensions and the managed + /// resource group storage account. This setting is currently + /// applicable only to Storage Account. Learn more here + /// https://go.microsoft.com/fwlink/?linkid=2247228. Possible values + /// include: 'Public', 'Private' + /// + [JsonProperty(PropertyName = "properties.managedResourcesNetworkAccessType")] + public string ManagedResourcesNetworkAccessType { 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', 'SoftShutdown' + /// + [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', 'ACSSInstallationBlocked' + /// + [JsonProperty(PropertyName = "properties.state")] + public string State { get; private set; } + + /// + /// Gets possible values include: 'Succeeded', 'Updating', 'Creating', + /// 'Failed', 'Deleting', 'Canceled' + /// + [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.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstanceState.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstanceState.cs new file mode 100644 index 0000000000000..55b118f88aaeb --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstanceState.cs @@ -0,0 +1,33 @@ +// +// 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.SAPVirtualInstance.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"; + public const string ACSSInstallationBlocked = "ACSSInstallationBlocked"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstanceStatus.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstanceStatus.cs new file mode 100644 index 0000000000000..9a7ece836350a --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstanceStatus.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.SAPVirtualInstance.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"; + public const string SoftShutdown = "SoftShutdown"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstancesDeleteHeaders.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstancesDeleteHeaders.cs new file mode 100644 index 0000000000000..fe1c15de8ee35 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstancesDeleteHeaders.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class SAPVirtualInstancesDeleteHeaders + { + /// + /// Initializes a new instance of the SAPVirtualInstancesDeleteHeaders + /// class. + /// + public SAPVirtualInstancesDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPVirtualInstancesDeleteHeaders + /// class. + /// + /// URL to poll for status updates. + public SAPVirtualInstancesDeleteHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URL to poll for status updates. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstancesStartHeaders.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstancesStartHeaders.cs new file mode 100644 index 0000000000000..787f874993b4b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstancesStartHeaders.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Start operation. + /// + public partial class SAPVirtualInstancesStartHeaders + { + /// + /// Initializes a new instance of the SAPVirtualInstancesStartHeaders + /// class. + /// + public SAPVirtualInstancesStartHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPVirtualInstancesStartHeaders + /// class. + /// + /// The URI to fetch the updated Virtual + /// Instance for SAP resource. + public SAPVirtualInstancesStartHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URI to fetch the updated Virtual Instance for SAP + /// resource. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstancesStopHeaders.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstancesStopHeaders.cs new file mode 100644 index 0000000000000..026533dec0a24 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstancesStopHeaders.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Stop operation. + /// + public partial class SAPVirtualInstancesStopHeaders + { + /// + /// Initializes a new instance of the SAPVirtualInstancesStopHeaders + /// class. + /// + public SAPVirtualInstancesStopHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPVirtualInstancesStopHeaders + /// class. + /// + /// The URI to fetch the updated Virtual + /// Instance for SAP resource. + public SAPVirtualInstancesStopHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URI to fetch the updated Virtual Instance for SAP + /// resource. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstancesUpdateHeaders.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstancesUpdateHeaders.cs new file mode 100644 index 0000000000000..d99f211ac6524 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SAPVirtualInstancesUpdateHeaders.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class SAPVirtualInstancesUpdateHeaders + { + /// + /// Initializes a new instance of the SAPVirtualInstancesUpdateHeaders + /// class. + /// + public SAPVirtualInstancesUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SAPVirtualInstancesUpdateHeaders + /// class. + /// + /// URL to poll for status updates. + public SAPVirtualInstancesUpdateHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URL to poll for status updates. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SapVirtualInstanceProvisioningState.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SapVirtualInstanceProvisioningState.cs new file mode 100644 index 0000000000000..9b6bba4181547 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SapVirtualInstanceProvisioningState.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.SAPVirtualInstance.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"; + public const string Canceled = "Canceled"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ServiceInitiatedSoftwareConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ServiceInitiatedSoftwareConfiguration.cs new file mode 100644 index 0000000000000..c6b3e6ad1d3ad --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SharedStorageResourceNames.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SharedStorageResourceNames.cs new file mode 100644 index 0000000000000..8d808d35f18a6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SharedStorageResourceNames.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource names object for shared storage. + /// + public partial class SharedStorageResourceNames + { + /// + /// Initializes a new instance of the SharedStorageResourceNames class. + /// + public SharedStorageResourceNames() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharedStorageResourceNames class. + /// + /// The full name of the shared + /// storage account. If it is not provided, it will be defaulted to + /// {SID}nfs{guid of 15 chars}. + /// The full name + /// of private end point for the shared storage account. If it is not + /// provided, it will be defaulted to {storageAccountName}_pe + public SharedStorageResourceNames(string sharedStorageAccountName = default(string), string sharedStorageAccountPrivateEndPointName = default(string)) + { + SharedStorageAccountName = sharedStorageAccountName; + SharedStorageAccountPrivateEndPointName = sharedStorageAccountPrivateEndPointName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the full name of the shared storage account. If it is + /// not provided, it will be defaulted to {SID}nfs{guid of 15 chars}. + /// + [JsonProperty(PropertyName = "sharedStorageAccountName")] + public string SharedStorageAccountName { get; set; } + + /// + /// Gets or sets the full name of private end point for the shared + /// storage account. If it is not provided, it will be defaulted to + /// {storageAccountName}_pe + /// + [JsonProperty(PropertyName = "sharedStorageAccountPrivateEndPointName")] + public string SharedStorageAccountPrivateEndPointName { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SingleServerConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SingleServerConfiguration.cs new file mode 100644 index 0000000000000..ffe81c2aa01ad --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SingleServerConfiguration.cs @@ -0,0 +1,128 @@ +// +// 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.SAPVirtualInstance.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the single server configuration. For prerequisites for + /// creating the infrastructure, please see + /// [here](https://go.microsoft.com/fwlink/?linkid=2212611&clcid=0x409) + /// + [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' + /// Gets or sets the disk + /// configuration. + /// The set of custom names to be + /// used for underlying azure resources that are part of the SAP + /// system. + public SingleServerConfiguration(string appResourceGroup, string subnetId, VirtualMachineConfiguration virtualMachineConfiguration, NetworkConfiguration networkConfiguration = default(NetworkConfiguration), string databaseType = default(string), DiskConfiguration dbDiskConfiguration = default(DiskConfiguration), SingleServerCustomResourceNames customResourceNames = default(SingleServerCustomResourceNames)) + : base(appResourceGroup) + { + NetworkConfiguration = networkConfiguration; + DatabaseType = databaseType; + SubnetId = subnetId; + VirtualMachineConfiguration = virtualMachineConfiguration; + DbDiskConfiguration = dbDiskConfiguration; + CustomResourceNames = customResourceNames; + 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; } + + /// + /// Gets or sets the disk configuration. + /// + [JsonProperty(PropertyName = "dbDiskConfiguration")] + public DiskConfiguration DbDiskConfiguration { get; set; } + + /// + /// Gets or sets the set of custom names to be used for underlying + /// azure resources that are part of the SAP system. + /// + [JsonProperty(PropertyName = "customResourceNames")] + public SingleServerCustomResourceNames CustomResourceNames { 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.SAPVirtualInstance/src/Generated/Models/SingleServerCustomResourceNames.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SingleServerCustomResourceNames.cs new file mode 100644 index 0000000000000..04d25c445bec3 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SingleServerCustomResourceNames.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.SAPVirtualInstance.Models +{ + using System.Linq; + + /// + /// The resource-names input to specify custom names for underlying azure + /// resources that are part of a single server SAP system. + /// + public partial class SingleServerCustomResourceNames + { + /// + /// Initializes a new instance of the SingleServerCustomResourceNames + /// class. + /// + public SingleServerCustomResourceNames() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SingleServerFullResourceNames.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SingleServerFullResourceNames.cs new file mode 100644 index 0000000000000..ed1314f0b56a6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SingleServerFullResourceNames.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource name object where the specified values will be full + /// resource names of the corresponding resources in a single server SAP + /// system. + /// + [Newtonsoft.Json.JsonObject("FullResourceName")] + public partial class SingleServerFullResourceNames : SingleServerCustomResourceNames + { + /// + /// Initializes a new instance of the SingleServerFullResourceNames + /// class. + /// + public SingleServerFullResourceNames() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SingleServerFullResourceNames + /// class. + /// + public SingleServerFullResourceNames(VirtualMachineResourceNames virtualMachine = default(VirtualMachineResourceNames)) + { + VirtualMachine = virtualMachine; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "virtualMachine")] + public VirtualMachineResourceNames VirtualMachine { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (VirtualMachine != null) + { + VirtualMachine.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SingleServerRecommendationResult.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SingleServerRecommendationResult.cs new file mode 100644 index 0000000000000..f140ea588212b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SkipFileShareConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SkipFileShareConfiguration.cs new file mode 100644 index 0000000000000..9263767fbbd29 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SkipFileShareConfiguration.cs @@ -0,0 +1,38 @@ +// +// 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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the file share configuration for scenarios where transport + /// directory fileshare is not created or required. + /// + [Newtonsoft.Json.JsonObject("Skip")] + public partial class SkipFileShareConfiguration : FileShareConfiguration + { + /// + /// Initializes a new instance of the SkipFileShareConfiguration class. + /// + public SkipFileShareConfiguration() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/Sku.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/Sku.cs new file mode 100644 index 0000000000000..c0da8d994dd5e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SkuTier.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SkuTier.cs new file mode 100644 index 0000000000000..15a7acbb46114 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SoftwareConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SoftwareConfiguration.cs new file mode 100644 index 0000000000000..09b5673cb5dff --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SshConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SshConfiguration.cs new file mode 100644 index 0000000000000..1bc153680d26b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SshKeyPair.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SshKeyPair.cs new file mode 100644 index 0000000000000..9222e07c1bffe --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/SshPublicKey.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SshPublicKey.cs new file mode 100644 index 0000000000000..4aecb347f35b9 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/StartRequest.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/StartRequest.cs new file mode 100644 index 0000000000000..0fde57ab52208 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/StartRequest.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Start SAP instance(s) request body. + /// + public partial class StartRequest + { + /// + /// Initializes a new instance of the StartRequest class. + /// + public StartRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StartRequest class. + /// + /// The boolean value indicates whether to start + /// the virtual machines before starting the SAP instances. + public StartRequest(bool? startVm = default(bool?)) + { + StartVm = startVm; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the boolean value indicates whether to start the + /// virtual machines before starting the SAP instances. + /// + [JsonProperty(PropertyName = "startVm")] + public bool? StartVm { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/StopRequest.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/StopRequest.cs new file mode 100644 index 0000000000000..f8dad92dd3dcf --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/StopRequest.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Stop SAP instance(s) request body. + /// + public partial class StopRequest + { + /// + /// Initializes a new instance of the StopRequest class. + /// + public StopRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StopRequest class. + /// + /// This parameter defines how + /// long (in seconds) the soft shutdown waits until the RFC/HTTP + /// clients no longer consider the server for calls with load + /// balancing. Value 0 means that the kernel does not wait, but goes + /// directly into the next shutdown state, i.e. hard stop. + /// The boolean value indicates whether to + /// Stop and deallocate the virtual machines along with the SAP + /// instances. + public StopRequest(long? softStopTimeoutSeconds = default(long?), bool? deallocateVm = default(bool?)) + { + SoftStopTimeoutSeconds = softStopTimeoutSeconds; + DeallocateVm = deallocateVm; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this parameter defines how long (in seconds) the soft + /// shutdown waits until the RFC/HTTP clients no longer consider the + /// server for calls with load balancing. Value 0 means that the kernel + /// does not wait, but goes directly into the next shutdown state, i.e. + /// hard stop. + /// + [JsonProperty(PropertyName = "softStopTimeoutSeconds")] + public long? SoftStopTimeoutSeconds { get; set; } + + /// + /// Gets or sets the boolean value indicates whether to Stop and + /// deallocate the virtual machines along with the SAP instances. + /// + [JsonProperty(PropertyName = "deallocateVm")] + public bool? DeallocateVm { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/StorageConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/StorageConfiguration.cs new file mode 100644 index 0000000000000..e5c4af1d58da5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/StorageConfiguration.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the storage configuration. + /// + public partial class StorageConfiguration + { + /// + /// Initializes a new instance of the StorageConfiguration class. + /// + public StorageConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageConfiguration class. + /// + /// The properties of the + /// transport directory attached to the VIS. The default for + /// transportFileShareConfiguration is the createAndMount flow if + /// storage configuration is missing. + public StorageConfiguration(FileShareConfiguration transportFileShareConfiguration = default(FileShareConfiguration)) + { + TransportFileShareConfiguration = transportFileShareConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the properties of the transport directory attached to + /// the VIS. The default for transportFileShareConfiguration is the + /// createAndMount flow if storage configuration is missing. + /// + [JsonProperty(PropertyName = "transportFileShareConfiguration")] + public FileShareConfiguration TransportFileShareConfiguration { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/StorageInformation.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/StorageInformation.cs new file mode 100644 index 0000000000000..20d2367e67057 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/StorageInformation.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Storage details of all the Storage accounts attached to the VM. For + /// e.g. NFS on AFS Shared Storage. + /// + public partial class StorageInformation + { + /// + /// Initializes a new instance of the StorageInformation class. + /// + public StorageInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageInformation class. + /// + public StorageInformation(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SystemData.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/SystemData.cs new file mode 100644 index 0000000000000..ccf65c0629873 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/ThreeTierConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ThreeTierConfiguration.cs new file mode 100644 index 0000000000000..d6983b2dff76f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ThreeTierConfiguration.cs @@ -0,0 +1,152 @@ +// +// 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.SAPVirtualInstance.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the three tier SAP configuration. For prerequisites for + /// creating the infrastructure, please see + /// [here](https://go.microsoft.com/fwlink/?linkid=2212611&clcid=0x409) + /// + [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. + /// The storage + /// configuration. + /// The set of custom names to be + /// used for underlying azure resources that are part of the SAP + /// system. + public ThreeTierConfiguration(string appResourceGroup, CentralServerConfiguration centralServer, ApplicationServerConfiguration applicationServer, DatabaseConfiguration databaseServer, NetworkConfiguration networkConfiguration = default(NetworkConfiguration), HighAvailabilityConfiguration highAvailabilityConfig = default(HighAvailabilityConfiguration), StorageConfiguration storageConfiguration = default(StorageConfiguration), ThreeTierCustomResourceNames customResourceNames = default(ThreeTierCustomResourceNames)) + : base(appResourceGroup) + { + NetworkConfiguration = networkConfiguration; + CentralServer = centralServer; + ApplicationServer = applicationServer; + DatabaseServer = databaseServer; + HighAvailabilityConfig = highAvailabilityConfig; + StorageConfiguration = storageConfiguration; + CustomResourceNames = customResourceNames; + 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; } + + /// + /// Gets or sets the storage configuration. + /// + [JsonProperty(PropertyName = "storageConfiguration")] + public StorageConfiguration StorageConfiguration { get; set; } + + /// + /// Gets or sets the set of custom names to be used for underlying + /// azure resources that are part of the SAP system. + /// + [JsonProperty(PropertyName = "customResourceNames")] + public ThreeTierCustomResourceNames CustomResourceNames { 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.SAPVirtualInstance/src/Generated/Models/ThreeTierCustomResourceNames.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ThreeTierCustomResourceNames.cs new file mode 100644 index 0000000000000..69944a779a534 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ThreeTierCustomResourceNames.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.SAPVirtualInstance.Models +{ + using System.Linq; + + /// + /// The resource-names input to specify custom names for underlying azure + /// resources that are part of a three tier SAP system. + /// + public partial class ThreeTierCustomResourceNames + { + /// + /// Initializes a new instance of the ThreeTierCustomResourceNames + /// class. + /// + public ThreeTierCustomResourceNames() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ThreeTierFullResourceNames.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ThreeTierFullResourceNames.cs new file mode 100644 index 0000000000000..15d896658e0da --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ThreeTierFullResourceNames.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource name object where the specified values will be full + /// resource names of the corresponding resources in a three tier SAP + /// system. + /// + [Newtonsoft.Json.JsonObject("FullResourceName")] + public partial class ThreeTierFullResourceNames : ThreeTierCustomResourceNames + { + /// + /// Initializes a new instance of the ThreeTierFullResourceNames class. + /// + public ThreeTierFullResourceNames() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThreeTierFullResourceNames class. + /// + public ThreeTierFullResourceNames(CentralServerFullResourceNames centralServer = default(CentralServerFullResourceNames), ApplicationServerFullResourceNames applicationServer = default(ApplicationServerFullResourceNames), DatabaseServerFullResourceNames databaseServer = default(DatabaseServerFullResourceNames), SharedStorageResourceNames sharedStorage = default(SharedStorageResourceNames)) + { + CentralServer = centralServer; + ApplicationServer = applicationServer; + DatabaseServer = databaseServer; + SharedStorage = sharedStorage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "centralServer")] + public CentralServerFullResourceNames CentralServer { get; set; } + + /// + /// + [JsonProperty(PropertyName = "applicationServer")] + public ApplicationServerFullResourceNames ApplicationServer { get; set; } + + /// + /// + [JsonProperty(PropertyName = "databaseServer")] + public DatabaseServerFullResourceNames DatabaseServer { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sharedStorage")] + public SharedStorageResourceNames SharedStorage { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CentralServer != null) + { + CentralServer.Validate(); + } + if (DatabaseServer != null) + { + DatabaseServer.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ThreeTierRecommendationResult.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/ThreeTierRecommendationResult.cs new file mode 100644 index 0000000000000..40aeaa68b3ab1 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/TrackedResource.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/TrackedResource.cs new file mode 100644 index 0000000000000..7c3defac309bc --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/UpdateSAPApplicationInstanceRequest.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/UpdateSAPApplicationInstanceRequest.cs new file mode 100644 index 0000000000000..a990f9e9ac511 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/UpdateSAPCentralInstanceRequest.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/UpdateSAPCentralInstanceRequest.cs new file mode 100644 index 0000000000000..050e1e3336bda --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/UpdateSAPDatabaseInstanceRequest.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/UpdateSAPDatabaseInstanceRequest.cs new file mode 100644 index 0000000000000..5c1480d517cfa --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/UpdateSAPVirtualInstanceProperties.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/UpdateSAPVirtualInstanceProperties.cs new file mode 100644 index 0000000000000..2dea871591c1a --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/UpdateSAPVirtualInstanceProperties.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.SAPVirtualInstance.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the properties to be updated for Virtual Instance for SAP. + /// + public partial class UpdateSAPVirtualInstanceProperties + { + /// + /// Initializes a new instance of the + /// UpdateSAPVirtualInstanceProperties class. + /// + public UpdateSAPVirtualInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// UpdateSAPVirtualInstanceProperties class. + /// + /// Specifies the + /// network access configuration for the resources that will be + /// deployed in the Managed Resource Group. The options to choose from + /// are Public and Private. If 'Private' is chosen, the Storage Account + /// service tag should be enabled on the subnets in which the SAP VMs + /// exist. This is required for establishing connectivity between VM + /// extensions and the managed resource group storage account. This + /// setting is currently applicable only to Storage Account. Learn more + /// here https://go.microsoft.com/fwlink/?linkid=2247228. Possible + /// values include: 'Public', 'Private' + public UpdateSAPVirtualInstanceProperties(string managedResourcesNetworkAccessType = default(string)) + { + ManagedResourcesNetworkAccessType = managedResourcesNetworkAccessType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the network access configuration for the + /// resources that will be deployed in the Managed Resource Group. The + /// options to choose from are Public and Private. If 'Private' is + /// chosen, the Storage Account service tag should be enabled on the + /// subnets in which the SAP VMs exist. This is required for + /// establishing connectivity between VM extensions and the managed + /// resource group storage account. This setting is currently + /// applicable only to Storage Account. Learn more here + /// https://go.microsoft.com/fwlink/?linkid=2247228. Possible values + /// include: 'Public', 'Private' + /// + [JsonProperty(PropertyName = "managedResourcesNetworkAccessType")] + public string ManagedResourcesNetworkAccessType { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/UpdateSAPVirtualInstanceRequest.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/UpdateSAPVirtualInstanceRequest.cs new file mode 100644 index 0000000000000..0b58fe8edec9d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/UpdateSAPVirtualInstanceRequest.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.SAPVirtualInstance.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), UpdateSAPVirtualInstanceProperties properties = default(UpdateSAPVirtualInstanceProperties)) + { + Tags = tags; + Identity = identity; + Properties = properties; + 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; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public UpdateSAPVirtualInstanceProperties Properties { 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.SAPVirtualInstance/src/Generated/Models/UserAssignedIdentity.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/UserAssignedIdentity.cs new file mode 100644 index 0000000000000..4e5c446ae04d9 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/UserAssignedServiceIdentity.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/UserAssignedServiceIdentity.cs new file mode 100644 index 0000000000000..d35aee3f05f93 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/VirtualMachineConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/VirtualMachineConfiguration.cs new file mode 100644 index 0000000000000..10985fb1291ab --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Models/VirtualMachineResourceNames.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/VirtualMachineResourceNames.cs new file mode 100644 index 0000000000000..bf942ac1d16d6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/VirtualMachineResourceNames.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.SAPVirtualInstance.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource names object for virtual machine and related resources. + /// + public partial class VirtualMachineResourceNames + { + /// + /// Initializes a new instance of the VirtualMachineResourceNames + /// class. + /// + public VirtualMachineResourceNames() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineResourceNames + /// class. + /// + /// The full name for virtual machine. The length + /// of this field can be upto 64 characters. If name is not provided, + /// service uses a default name based on the deployment type. For + /// SingleServer, default name is {SID}vm. In case of HA-AvZone + /// systems, default name will be {SID}{app/ascs/db}z{a/b}vm with an + /// incrementor at the end in case of more than 1 vm per layer. For + /// distributed and HA-AvSet systems, default name will be + /// {SID}{app/ascs/db}vm with an incrementor at the end in case of more + /// than 1 vm per layer. + /// The full name for virtual-machine's host + /// (computer name). Currently, ACSS only supports host names which are + /// less than or equal to 13 characters long. If this value is not + /// provided, vmName will be used as host name. + /// The list of network interface name + /// objects for the selected virtual machine. Currently, only one + /// network interface is supported per virtual machine. + /// The full name for OS disk attached to the + /// VM. If this value is not provided, it will be named by ARM as per + /// its default naming standards (prefixed with vm name). There is only + /// one OS disk attached per Virtual Machine. + /// The full resource names for virtual + /// machine data disks. This is a dictionary containing list of names + /// of data disks per volume. Currently supported volumes for database + /// layer are ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os', + /// 'backup']. For application and cs layers, only 'default' volume is + /// supported + public VirtualMachineResourceNames(string vmName = default(string), string hostName = default(string), IList networkInterfaces = default(IList), string osDiskName = default(string), IDictionary> dataDiskNames = default(IDictionary>)) + { + VmName = vmName; + HostName = hostName; + NetworkInterfaces = networkInterfaces; + OsDiskName = osDiskName; + DataDiskNames = dataDiskNames; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the full name for virtual machine. The length of this + /// field can be upto 64 characters. If name is not provided, service + /// uses a default name based on the deployment type. For SingleServer, + /// default name is {SID}vm. In case of HA-AvZone systems, default name + /// will be {SID}{app/ascs/db}z{a/b}vm with an incrementor at the end + /// in case of more than 1 vm per layer. For distributed and HA-AvSet + /// systems, default name will be {SID}{app/ascs/db}vm with an + /// incrementor at the end in case of more than 1 vm per layer. + /// + [JsonProperty(PropertyName = "vmName")] + public string VmName { get; set; } + + /// + /// Gets or sets the full name for virtual-machine's host (computer + /// name). Currently, ACSS only supports host names which are less than + /// or equal to 13 characters long. If this value is not provided, + /// vmName will be used as host name. + /// + [JsonProperty(PropertyName = "hostName")] + public string HostName { get; set; } + + /// + /// Gets or sets the list of network interface name objects for the + /// selected virtual machine. Currently, only one network interface is + /// supported per virtual machine. + /// + [JsonProperty(PropertyName = "networkInterfaces")] + public IList NetworkInterfaces { get; set; } + + /// + /// Gets or sets the full name for OS disk attached to the VM. If this + /// value is not provided, it will be named by ARM as per its default + /// naming standards (prefixed with vm name). There is only one OS disk + /// attached per Virtual Machine. + /// + [JsonProperty(PropertyName = "osDiskName")] + public string OsDiskName { get; set; } + + /// + /// Gets or sets the full resource names for virtual machine data + /// disks. This is a dictionary containing list of names of data disks + /// per volume. Currently supported volumes for database layer are + /// ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. + /// For application and cs layers, only 'default' volume is supported + /// + [JsonProperty(PropertyName = "dataDiskNames")] + public IDictionary> DataDiskNames { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (NetworkInterfaces != null) + { + if (NetworkInterfaces.Count > 1) + { + throw new ValidationException(ValidationRules.MaxItems, "NetworkInterfaces", 1); + } + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/WindowsConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Models/WindowsConfiguration.cs new file mode 100644 index 0000000000000..9e7b4e54f84bb --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance.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.SAPVirtualInstance/src/Generated/Operations.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Operations.cs new file mode 100644 index 0000000000000..26706585d141e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/Operations.cs @@ -0,0 +1,382 @@ +// +// 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.SAPVirtualInstance +{ + 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 + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + string apiVersion = "2023-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + 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 (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("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.SAPVirtualInstance/src/Generated/OperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/OperationsExtensions.cs new file mode 100644 index 0000000000000..a8527a7744409 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance +{ + 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.SAPVirtualInstance/src/Generated/SAPApplicationServerInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPApplicationServerInstancesOperations.cs new file mode 100644 index 0000000000000..aac5cfa6ef310 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPApplicationServerInstancesOperations.cs @@ -0,0 +1,2031 @@ +// +// 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.SAPVirtualInstance +{ + 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (applicationInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationInstanceName"); + } + if (applicationInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(applicationInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "applicationInstanceName", "^.*"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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); + } + + /// + /// Updates the SAP Application server instance resource. 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 + /// + /// + /// 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> UpdateWithHttpMessagesAsync(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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (applicationInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationInstanceName"); + } + if (applicationInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(applicationInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "applicationInstanceName", "^.*"); + } + } + string apiVersion = "2023-10-01-preview"; + 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("apiVersion", apiVersion); + 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}/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 (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("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 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 + AzureOperationHeaderResponse _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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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 Server Instance. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> StartInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, bool? startVm = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, startVm, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Stops the SAP Application Server Instance. + /// + /// + /// 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. + /// + /// + /// SAP Application server instance stop request body. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> StopInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, StopRequest body = default(StopRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStopInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (applicationInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationInstanceName"); + } + if (applicationInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(applicationInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "applicationInstanceName", "^.*"); + } + } + if (body != null) + { + body.Validate(); + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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 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 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (applicationInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationInstanceName"); + } + if (applicationInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(applicationInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "applicationInstanceName", "^.*"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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 != 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 AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Starts the SAP Application Server Instance. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// 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> BeginStartInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, bool? startVm = 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (applicationInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationInstanceName"); + } + if (applicationInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(applicationInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "applicationInstanceName", "^.*"); + } + } + string apiVersion = "2023-10-01-preview"; + StartRequest body = default(StartRequest); + if (startVm != null) + { + body = new StartRequest(); + body.StartVm = startVm; + } + // 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("apiVersion", apiVersion); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStartInstance", 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}/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)); + _url = _url.Replace("{applicationInstanceName}", System.Uri.EscapeDataString(applicationInstanceName)); + 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 (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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Stops the SAP Application Server Instance. + /// + /// + /// 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. + /// + /// + /// SAP Application server instance stop 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> BeginStopInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, StopRequest body = default(StopRequest), 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (applicationInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationInstanceName"); + } + if (applicationInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(applicationInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "applicationInstanceName", "^.*"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStopInstance", 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}/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)); + _url = _url.Replace("{applicationInstanceName}", System.Uri.EscapeDataString(applicationInstanceName)); + 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 (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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), 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.SAPVirtualInstance/src/Generated/SAPApplicationServerInstancesOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPApplicationServerInstancesOperationsExtensions.cs new file mode 100644 index 0000000000000..e7abc7d31a30e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPApplicationServerInstancesOperationsExtensions.cs @@ -0,0 +1,631 @@ +// +// 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.SAPVirtualInstance +{ + 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; + } + } + + /// + /// Updates the SAP Application server instance resource. 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 + /// + /// + /// 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(); + } + + /// + /// Updates the SAP Application server instance resource. 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 + /// + /// + /// 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 SAPApplicationServerInstancesDeleteHeaders 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.Headers; + } + } + + /// + /// 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; + } + } + + /// + /// Starts the SAP Application Server 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 name of SAP Application Server instance resource. + /// + /// + /// The boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + public static OperationStatusResult StartInstance(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, bool? startVm = false) + { + return operations.StartInstanceAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, startVm).GetAwaiter().GetResult(); + } + + /// + /// Starts the SAP Application Server 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 name of SAP Application Server instance resource. + /// + /// + /// The boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// The cancellation token. + /// + public static async Task StartInstanceAsync(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, bool? startVm = false, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.StartInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, startVm, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Stops the SAP Application Server 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 name of SAP Application Server instance resource. + /// + /// + /// SAP Application server instance stop request body. + /// + public static OperationStatusResult StopInstance(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, StopRequest body = default(StopRequest)) + { + return operations.StopInstanceAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, body).GetAwaiter().GetResult(); + } + + /// + /// Stops the SAP Application Server 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 name of SAP Application Server instance resource. + /// + /// + /// SAP Application server instance stop request body. + /// + /// + /// The cancellation token. + /// + public static async Task StopInstanceAsync(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, StopRequest body = default(StopRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.StopInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, body, 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; + } + } + + /// + /// 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 SAPApplicationServerInstancesDeleteHeaders 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.Headers; + } + } + + /// + /// Starts the SAP Application Server 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 name of SAP Application Server instance resource. + /// + /// + /// The boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + public static OperationStatusResult BeginStartInstance(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, bool? startVm = false) + { + return operations.BeginStartInstanceAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, startVm).GetAwaiter().GetResult(); + } + + /// + /// Starts the SAP Application Server 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 name of SAP Application Server instance resource. + /// + /// + /// The boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartInstanceAsync(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, bool? startVm = false, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginStartInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, startVm, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Stops the SAP Application Server 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 name of SAP Application Server instance resource. + /// + /// + /// SAP Application server instance stop request body. + /// + public static OperationStatusResult BeginStopInstance(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, StopRequest body = default(StopRequest)) + { + return operations.BeginStopInstanceAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, body).GetAwaiter().GetResult(); + } + + /// + /// Stops the SAP Application Server 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 name of SAP Application Server instance resource. + /// + /// + /// SAP Application server instance stop request body. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStopInstanceAsync(this ISAPApplicationServerInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string applicationInstanceName, StopRequest body = default(StopRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginStopInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, applicationInstanceName, body, 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.SAPVirtualInstance/src/Generated/SAPCentralInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPCentralInstancesOperations.cs new file mode 100644 index 0000000000000..f69be0fb400e7 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPCentralInstancesOperations.cs @@ -0,0 +1,2044 @@ +// +// 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.SAPVirtualInstance +{ + 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (centralInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "centralInstanceName"); + } + if (centralInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(centralInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "centralInstanceName", "^.*"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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. + /// + /// + /// 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, 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (centralInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "centralInstanceName"); + } + if (centralInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(centralInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "centralInstanceName", "^.*"); + } + } + string apiVersion = "2023-10-01-preview"; + 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("apiVersion", apiVersion); + 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}/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 (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("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 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 + AzureOperationHeaderResponse _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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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 Central Services Instance. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> StartInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, bool? startVm = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, startVm, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Stops the SAP Central Services Instance. + /// + /// + /// 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. + /// + /// + /// SAP Central Services instance stop request body. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> StopInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, StopRequest body = default(StopRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStopInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (centralInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "centralInstanceName"); + } + if (centralInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(centralInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "centralInstanceName", "^.*"); + } + } + if (body != null) + { + body.Validate(); + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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 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 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (centralInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "centralInstanceName"); + } + if (centralInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(centralInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "centralInstanceName", "^.*"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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 != 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 AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Starts the SAP Central Services Instance. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// 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> BeginStartInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, bool? startVm = 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (centralInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "centralInstanceName"); + } + if (centralInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(centralInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "centralInstanceName", "^.*"); + } + } + string apiVersion = "2023-10-01-preview"; + StartRequest body = default(StartRequest); + if (startVm != null) + { + body = new StartRequest(); + body.StartVm = startVm; + } + // 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("apiVersion", apiVersion); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStartInstance", 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}/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)); + _url = _url.Replace("{centralInstanceName}", System.Uri.EscapeDataString(centralInstanceName)); + 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 (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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Stops the SAP Central Services Instance. + /// + /// + /// 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. + /// + /// + /// SAP Central Services instance stop 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> BeginStopInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, StopRequest body = default(StopRequest), 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (centralInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "centralInstanceName"); + } + if (centralInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(centralInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "centralInstanceName", "^.*"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStopInstance", 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}/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)); + _url = _url.Replace("{centralInstanceName}", System.Uri.EscapeDataString(centralInstanceName)); + 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 (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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), 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.SAPVirtualInstance/src/Generated/SAPCentralInstancesOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPCentralInstancesOperationsExtensions.cs new file mode 100644 index 0000000000000..048ee339e6d6e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPCentralInstancesOperationsExtensions.cs @@ -0,0 +1,657 @@ +// +// 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.SAPVirtualInstance +{ + 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 SAPCentralInstancesDeleteHeaders 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.Headers; + } + } + + /// + /// 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; + } + } + + /// + /// Starts the SAP 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 + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// The boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + public static OperationStatusResult StartInstance(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, bool? startVm = false) + { + return operations.StartInstanceAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, startVm).GetAwaiter().GetResult(); + } + + /// + /// Starts the SAP 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 + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// The boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// The cancellation token. + /// + public static async Task StartInstanceAsync(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, bool? startVm = false, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.StartInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, startVm, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Stops the SAP 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 + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// SAP Central Services instance stop request body. + /// + public static OperationStatusResult StopInstance(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, StopRequest body = default(StopRequest)) + { + return operations.StopInstanceAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, body).GetAwaiter().GetResult(); + } + + /// + /// Stops the SAP 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 + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// SAP Central Services instance stop request body. + /// + /// + /// The cancellation token. + /// + public static async Task StopInstanceAsync(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, StopRequest body = default(StopRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.StopInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, body, 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; + } + } + + /// + /// 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 SAPCentralInstancesDeleteHeaders 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.Headers; + } + } + + /// + /// Starts the SAP 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 + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// The boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + public static OperationStatusResult BeginStartInstance(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, bool? startVm = false) + { + return operations.BeginStartInstanceAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, startVm).GetAwaiter().GetResult(); + } + + /// + /// Starts the SAP 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 + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// The boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartInstanceAsync(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, bool? startVm = false, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginStartInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, startVm, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Stops the SAP 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 + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// SAP Central Services instance stop request body. + /// + public static OperationStatusResult BeginStopInstance(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, StopRequest body = default(StopRequest)) + { + return operations.BeginStopInstanceAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, body).GetAwaiter().GetResult(); + } + + /// + /// Stops the SAP 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 + /// + /// + /// Central Services Instance resource name string modeled as parameter for + /// auto generation to work correctly. + /// + /// + /// SAP Central Services instance stop request body. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStopInstanceAsync(this ISAPCentralInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string centralInstanceName, StopRequest body = default(StopRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginStopInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, centralInstanceName, body, 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.SAPVirtualInstance/src/Generated/SAPDatabaseInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPDatabaseInstancesOperations.cs new file mode 100644 index 0000000000000..2e5c33b38334e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPDatabaseInstancesOperations.cs @@ -0,0 +1,2040 @@ +// +// 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.SAPVirtualInstance +{ + 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (databaseInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseInstanceName"); + } + if (databaseInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(databaseInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "databaseInstanceName", "^.*"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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 instance resource. 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 + /// + /// + /// 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> UpdateWithHttpMessagesAsync(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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (databaseInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseInstanceName"); + } + if (databaseInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(databaseInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "databaseInstanceName", "^.*"); + } + } + string apiVersion = "2023-10-01-preview"; + 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("apiVersion", apiVersion); + 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}/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 (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("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 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 + AzureOperationHeaderResponse _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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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 database instance of the SAP system. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> StartInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, bool? startVm = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, startVm, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Stops the database instance of the SAP system. + /// + /// + /// 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. + /// + /// + /// Stop request for the database instance of the SAP system. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> StopInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, StopRequest body = default(StopRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStopInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (databaseInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseInstanceName"); + } + if (databaseInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(databaseInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "databaseInstanceName", "^.*"); + } + } + if (body != null) + { + body.Validate(); + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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 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 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (databaseInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseInstanceName"); + } + if (databaseInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(databaseInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "databaseInstanceName", "^.*"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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 != 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 AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Starts the database instance of the SAP system. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// 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> BeginStartInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, bool? startVm = 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (databaseInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseInstanceName"); + } + if (databaseInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(databaseInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "databaseInstanceName", "^.*"); + } + } + string apiVersion = "2023-10-01-preview"; + StartRequest body = default(StartRequest); + if (startVm != null) + { + body = new StartRequest(); + body.StartVm = startVm; + } + // 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("apiVersion", apiVersion); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStartInstance", 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}/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)); + _url = _url.Replace("{databaseInstanceName}", System.Uri.EscapeDataString(databaseInstanceName)); + 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 (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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Stops the database instance of the SAP system. + /// + /// + /// 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. + /// + /// + /// Stop request for the database instance of the 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> BeginStopInstanceWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, StopRequest body = default(StopRequest), 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (databaseInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseInstanceName"); + } + if (databaseInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(databaseInstanceName, "^.*")) + { + throw new ValidationException(ValidationRules.Pattern, "databaseInstanceName", "^.*"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStopInstance", 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}/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)); + _url = _url.Replace("{databaseInstanceName}", System.Uri.EscapeDataString(databaseInstanceName)); + 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 (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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), 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.SAPVirtualInstance/src/Generated/SAPDatabaseInstancesOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPDatabaseInstancesOperationsExtensions.cs new file mode 100644 index 0000000000000..a0787254f8d6a --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPDatabaseInstancesOperationsExtensions.cs @@ -0,0 +1,649 @@ +// +// 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.SAPVirtualInstance +{ + 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 instance resource. 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 + /// + /// + /// 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 instance resource. 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 + /// + /// + /// 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 SAPDatabaseInstancesDeleteHeaders 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.Headers; + } + } + + /// + /// 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; + } + } + + /// + /// Starts the database instance of the SAP system. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + public static OperationStatusResult StartInstance(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, bool? startVm = false) + { + return operations.StartInstanceAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, startVm).GetAwaiter().GetResult(); + } + + /// + /// Starts the database instance of the SAP system. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// The cancellation token. + /// + public static async Task StartInstanceAsync(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, bool? startVm = false, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.StartInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, startVm, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Stops the database instance of the SAP system. + /// + /// + /// 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. + /// + /// + /// Stop request for the database instance of the SAP system. + /// + public static OperationStatusResult StopInstance(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, StopRequest body = default(StopRequest)) + { + return operations.StopInstanceAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, body).GetAwaiter().GetResult(); + } + + /// + /// Stops the database instance of the SAP system. + /// + /// + /// 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. + /// + /// + /// Stop request for the database instance of the SAP system. + /// + /// + /// The cancellation token. + /// + public static async Task StopInstanceAsync(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, StopRequest body = default(StopRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.StopInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, body, 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; + } + } + + /// + /// 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 SAPDatabaseInstancesDeleteHeaders 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.Headers; + } + } + + /// + /// Starts the database instance of the SAP system. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + public static OperationStatusResult BeginStartInstance(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, bool? startVm = false) + { + return operations.BeginStartInstanceAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, startVm).GetAwaiter().GetResult(); + } + + /// + /// Starts the database instance of the SAP system. + /// + /// + /// 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 boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartInstanceAsync(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, bool? startVm = false, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginStartInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, startVm, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Stops the database instance of the SAP system. + /// + /// + /// 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. + /// + /// + /// Stop request for the database instance of the SAP system. + /// + public static OperationStatusResult BeginStopInstance(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, StopRequest body = default(StopRequest)) + { + return operations.BeginStopInstanceAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, body).GetAwaiter().GetResult(); + } + + /// + /// Stops the database instance of the SAP system. + /// + /// + /// 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. + /// + /// + /// Stop request for the database instance of the SAP system. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStopInstanceAsync(this ISAPDatabaseInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, string databaseInstanceName, StopRequest body = default(StopRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginStopInstanceWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, databaseInstanceName, body, 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.SAPVirtualInstance/src/Generated/SAPVirtualInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPVirtualInstancesOperations.cs new file mode 100644 index 0000000000000..ffe653f1c8600 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPVirtualInstancesOperations.cs @@ -0,0 +1,2299 @@ +// +// 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.SAPVirtualInstance +{ + 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, SAPVirtualInstanceModel body = default(SAPVirtualInstanceModel), 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, UpdateSAPVirtualInstanceRequest body = default(UpdateSAPVirtualInstanceRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// 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 + AzureOperationHeaderResponse _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); + } + } + string apiVersion = "2023-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + 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 (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("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); + } + } + string apiVersion = "2023-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + 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 (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("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 boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> StartWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, bool? startVm = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, startVm, 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 + /// + /// + /// The Virtual Instance for SAP solutions resource stop request body. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> StopWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, StopRequest body = default(StopRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, body, 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, SAPVirtualInstanceModel body = default(SAPVirtualInstanceModel), 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + if (body != null) + { + body.Validate(); + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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 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> BeginUpdateWithHttpMessagesAsync(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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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}").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 (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("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 != 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); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), 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 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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 != 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 AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), 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 boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// 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, bool? startVm = 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + string apiVersion = "2023-10-01-preview"; + StartRequest body = default(StartRequest); + if (startVm != null) + { + body = new StartRequest(); + body.StartVm = startVm; + } + // 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("apiVersion", apiVersion); + tracingParameters.Add("body", body); + 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 (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 (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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), 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 + /// + /// + /// The Virtual Instance for SAP solutions resource stop 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> BeginStopWithHttpMessagesAsync(string resourceGroupName, string sapVirtualInstanceName, StopRequest body = default(StopRequest), 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 (sapVirtualInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(sapVirtualInstanceName, "^[a-zA-Z][a-zA-Z0-9]{2}$")) + { + throw new ValidationException(ValidationRules.Pattern, "sapVirtualInstanceName", "^[a-zA-Z][a-zA-Z0-9]{2}$"); + } + } + string apiVersion = "2023-10-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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 (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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), 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.SAPVirtualInstance/src/Generated/SAPVirtualInstancesOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPVirtualInstancesOperationsExtensions.cs new file mode 100644 index 0000000000000..93c856e7efe7f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SAPVirtualInstancesOperationsExtensions.cs @@ -0,0 +1,663 @@ +// +// 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.SAPVirtualInstance +{ + 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 SAPVirtualInstanceModel Create(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, SAPVirtualInstanceModel body = default(SAPVirtualInstanceModel)) + { + 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, SAPVirtualInstanceModel body = default(SAPVirtualInstanceModel), 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 SAPVirtualInstanceModel 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 SAPVirtualInstanceModel 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 SAPVirtualInstancesDeleteHeaders 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.Headers; + } + } + + /// + /// 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 + /// + /// + /// The boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + public static OperationStatusResult Start(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, bool? startVm = false) + { + return operations.StartAsync(resourceGroupName, sapVirtualInstanceName, startVm).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 boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, bool? startVm = false, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.StartWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, startVm, 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 + /// + /// + /// The Virtual Instance for SAP solutions resource stop request body. + /// + public static OperationStatusResult Stop(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, StopRequest body = default(StopRequest)) + { + return operations.StopAsync(resourceGroupName, sapVirtualInstanceName, body).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 + /// + /// + /// The Virtual Instance for SAP solutions resource stop request body. + /// + /// + /// The cancellation token. + /// + public static async Task StopAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, StopRequest body = default(StopRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.StopWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, body, 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 SAPVirtualInstanceModel BeginCreate(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, SAPVirtualInstanceModel body = default(SAPVirtualInstanceModel)) + { + 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, SAPVirtualInstanceModel body = default(SAPVirtualInstanceModel), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, body, 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 SAPVirtualInstanceModel BeginUpdate(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, UpdateSAPVirtualInstanceRequest body = default(UpdateSAPVirtualInstanceRequest)) + { + return operations.BeginUpdateAsync(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 BeginUpdateAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, UpdateSAPVirtualInstanceRequest body = default(UpdateSAPVirtualInstanceRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(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 SAPVirtualInstancesDeleteHeaders 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.Headers; + } + } + + /// + /// 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 boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + public static OperationStatusResult BeginStart(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, bool? startVm = false) + { + return operations.BeginStartAsync(resourceGroupName, sapVirtualInstanceName, startVm).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 boolean value indicates whether to start the virtual machines before + /// starting the SAP instances. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, bool? startVm = false, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, startVm, 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 + /// + /// + /// The Virtual Instance for SAP solutions resource stop request body. + /// + public static OperationStatusResult BeginStop(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, StopRequest body = default(StopRequest)) + { + return operations.BeginStopAsync(resourceGroupName, sapVirtualInstanceName, body).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 + /// + /// + /// The Virtual Instance for SAP solutions resource stop request body. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStopAsync(this ISAPVirtualInstancesOperations operations, string resourceGroupName, string sapVirtualInstanceName, StopRequest body = default(StopRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginStopWithHttpMessagesAsync(resourceGroupName, sapVirtualInstanceName, body, 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.SAPVirtualInstance/src/Generated/SdkInfo_WorkloadsClient.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SdkInfo_WorkloadsClient.cs new file mode 100644 index 0000000000000..9dfafa0e499ce --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/SdkInfo_WorkloadsClient.cs @@ -0,0 +1,35 @@ + +// +// 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.SAPVirtualInstance +{ + 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", "2023-10-01-preview"), + new Tuple("Workloads", "SAPApplicationServerInstances", "2023-10-01-preview"), + new Tuple("Workloads", "SAPAvailabilityZoneDetails", "2023-10-01-preview"), + new Tuple("Workloads", "SAPCentralInstances", "2023-10-01-preview"), + new Tuple("Workloads", "SAPDatabaseInstances", "2023-10-01-preview"), + new Tuple("Workloads", "SAPDiskConfigurations", "2023-10-01-preview"), + new Tuple("Workloads", "SAPSizingRecommendations", "2023-10-01-preview"), + new Tuple("Workloads", "SAPSupportedSku", "2023-10-01-preview"), + new Tuple("Workloads", "SAPVirtualInstances", "2023-10-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/WorkloadsClient.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/WorkloadsClient.cs new file mode 100644 index 0000000000000..2fd769c76885f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/WorkloadsClient.cs @@ -0,0 +1,1226 @@ +// +// 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.SAPVirtualInstance +{ + 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 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 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; } + + /// + /// 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() + { + SAPVirtualInstances = new SAPVirtualInstancesOperations(this); + SAPCentralInstances = new SAPCentralInstancesOperations(this); + SAPDatabaseInstances = new SAPDatabaseInstancesOperations(this); + SAPApplicationServerInstances = new SAPApplicationServerInstancesOperations(this); + Operations = new Operations(this); + BaseUri = new System.Uri("https://management.azure.com"); + 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("namingPatternType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("namingPatternType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("configurationType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("configurationType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("namingPatternType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("namingPatternType")); + 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")); + 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 (sAPSizingRecommendation != null) + { + sAPSizingRecommendation.Validate(); + } + string apiVersion = "2023-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + 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 (sAPSupportedSku != null) + { + sAPSupportedSku.Validate(); + } + string apiVersion = "2023-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + 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 (sAPDiskConfigurations != null) + { + sAPDiskConfigurations.Validate(); + } + string apiVersion = "2023-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + 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 (sAPAvailabilityZoneDetails != null) + { + sAPAvailabilityZoneDetails.Validate(); + } + string apiVersion = "2023-10-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + 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.SAPVirtualInstance/src/Generated/WorkloadsClientExtensions.cs b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/src/Generated/WorkloadsClientExtensions.cs new file mode 100644 index 0000000000000..7fb55971ae476 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPVirtualInstance/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.SAPVirtualInstance +{ + 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; + } + } + + } +}