diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/IMonitorsOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/IMonitorsOperations.cs new file mode 100644 index 000000000000..063545dc4a5b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/IMonitorsOperations.cs @@ -0,0 +1,303 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MonitorsOperations operations. + /// + public partial interface IMonitorsOperations + { + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The + /// operations returns various properties of each SAP monitor. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets properties of a SAP monitor. + /// + /// + /// Gets properties of a SAP monitor for the specified subscription, + /// resource group, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource + /// group, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, Monitor monitorParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource + /// group, and SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Patches the Tags field of a SAP monitor. + /// + /// + /// Patches the Tags field of a SAP monitor for the specified + /// subscription, resource group, and SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The Update SAP workload monitor request body. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string monitorName, UpdateMonitorRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource + /// group, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, Monitor monitorParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource + /// group, and SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The + /// operations returns various properties of each SAP monitor. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/IOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/IOperations.cs new file mode 100644 index 000000000000..13c55c9e4b1c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors +{ + 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.SAPMonitors/src/Generated/IProviderInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/IProviderInstancesOperations.cs new file mode 100644 index 000000000000..2f2a563b165b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/IProviderInstancesOperations.cs @@ -0,0 +1,242 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProviderInstancesOperations operations. + /// + public partial interface IProviderInstancesOperations + { + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets properties of a provider instance. + /// + /// + /// Gets properties of a provider instance for the specified + /// subscription, resource group, SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, + /// resource group, SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Defines the provider specific properties. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, ProviderSpecificProperties providerSettings = default(ProviderSpecificProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, + /// resource group, SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, + /// resource group, SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Defines the provider specific properties. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, ProviderSpecificProperties providerSettings = default(ProviderSpecificProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, + /// resource group, SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/ISapLandscapeMonitorOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/ISapLandscapeMonitorOperations.cs new file mode 100644 index 000000000000..ef9c1783960f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/ISapLandscapeMonitorOperations.cs @@ -0,0 +1,177 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SapLandscapeMonitorOperations operations. + /// + public partial interface ISapLandscapeMonitorOperations + { + /// + /// Gets configuration values for Single Pane Of Glass for SAP monitor. + /// + /// + /// Gets configuration values for Single Pane Of Glass for SAP monitor + /// for the specified subscription, resource group, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a SAP Landscape Monitor Dashboard. + /// + /// + /// Creates a SAP Landscape Monitor Dashboard for the specified + /// subscription, resource group, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a configuration for Sap Landscape Monitor + /// Dashboard + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, SapLandscapeMonitor sapLandscapeMonitorParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a SAP Landscape Monitor Dashboard. + /// + /// + /// Deletes a SAP Landscape Monitor Dashboard with the specified + /// subscription, resource group, and SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Patches the SAP Landscape Monitor Dashboard. + /// + /// + /// Patches the SAP Landscape Monitor Dashboard for the specified + /// subscription, resource group, and SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a configuration for Sap Landscape Monitor + /// Dashboard + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string monitorName, SapLandscapeMonitor sapLandscapeMonitorParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets configuration values for Single Pane Of Glass for SAP monitor. + /// + /// + /// Gets configuration values for Single Pane Of Glass for SAP monitor + /// for the specified subscription, resource group, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/IWorkloadsClient.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/IWorkloadsClient.cs new file mode 100644 index 000000000000..9c049106c61d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/IWorkloadsClient.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// + 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 API version to use for this operation. + /// + string ApiVersion { get; } + + /// + /// 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 IMonitorsOperations. + /// + IMonitorsOperations Monitors { get; } + + /// + /// Gets the IProviderInstancesOperations. + /// + IProviderInstancesOperations ProviderInstances { get; } + + /// + /// Gets the ISapLandscapeMonitorOperations. + /// + ISapLandscapeMonitorOperations SapLandscapeMonitor { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ActionType.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ActionType.cs new file mode 100644 index 000000000000..6e5551cb5baa --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.Models +{ + + /// + /// Defines values for ActionType. + /// + public static class ActionType + { + public const string Internal = "Internal"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/AzureEntityResource.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/AzureEntityResource.cs new file mode 100644 index 000000000000..4c655285ddaa --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/CreatedByType.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/CreatedByType.cs new file mode 100644 index 000000000000..5e69c872fc56 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/DB2ProviderInstanceProperties.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/DB2ProviderInstanceProperties.cs new file mode 100644 index 000000000000..167417de7ccf --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/DB2ProviderInstanceProperties.cs @@ -0,0 +1,127 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the DB2 provider properties. + /// + [Newtonsoft.Json.JsonObject("Db2")] + public partial class DB2ProviderInstanceProperties : ProviderSpecificProperties + { + /// + /// Initializes a new instance of the DB2ProviderInstanceProperties + /// class. + /// + public DB2ProviderInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DB2ProviderInstanceProperties + /// class. + /// + /// Gets or sets the target virtual machine + /// name. + /// Gets or sets the db2 database name. + /// Gets or sets the db2 database sql + /// port. + /// Gets or sets the db2 database user + /// name. + /// Gets or sets the db2 database + /// password. + /// Gets or sets the key vault URI to + /// secret with the database password. + /// Gets or sets the SAP System Identifier + /// Possible values include: 'Disabled', + /// 'RootCertificate', 'ServerCertificate' + /// Gets or sets the blob URI to SSL + /// certificate for the DB2 Database. + public DB2ProviderInstanceProperties(string hostname = default(string), string dbName = default(string), string dbPort = default(string), string dbUsername = default(string), string dbPassword = default(string), string dbPasswordUri = default(string), string sapSid = default(string), string sslPreference = default(string), string sslCertificateUri = default(string)) + { + Hostname = hostname; + DbName = dbName; + DbPort = dbPort; + DbUsername = dbUsername; + DbPassword = dbPassword; + DbPasswordUri = dbPasswordUri; + SapSid = sapSid; + SslPreference = sslPreference; + SslCertificateUri = sslCertificateUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the target virtual machine name. + /// + [JsonProperty(PropertyName = "hostname")] + public string Hostname { get; set; } + + /// + /// Gets or sets the db2 database name. + /// + [JsonProperty(PropertyName = "dbName")] + public string DbName { get; set; } + + /// + /// Gets or sets the db2 database sql port. + /// + [JsonProperty(PropertyName = "dbPort")] + public string DbPort { get; set; } + + /// + /// Gets or sets the db2 database user name. + /// + [JsonProperty(PropertyName = "dbUsername")] + public string DbUsername { get; set; } + + /// + /// Gets or sets the db2 database password. + /// + [JsonProperty(PropertyName = "dbPassword")] + public string DbPassword { get; set; } + + /// + /// Gets or sets the key vault URI to secret with the database + /// password. + /// + [JsonProperty(PropertyName = "dbPasswordUri")] + public string DbPasswordUri { get; set; } + + /// + /// Gets or sets the SAP System Identifier + /// + [JsonProperty(PropertyName = "sapSid")] + public string SapSid { get; set; } + + /// + /// Gets or sets possible values include: 'Disabled', + /// 'RootCertificate', 'ServerCertificate' + /// + [JsonProperty(PropertyName = "sslPreference")] + public string SslPreference { get; set; } + + /// + /// Gets or sets the blob URI to SSL certificate for the DB2 Database. + /// + [JsonProperty(PropertyName = "sslCertificateUri")] + public string SslCertificateUri { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Error.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Error.cs new file mode 100644 index 000000000000..e4d57245a167 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Error.cs @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Standard error object. + /// + public partial class Error + { + /// + /// Initializes a new instance of the Error class. + /// + public Error() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Error class. + /// + /// Server-defined set of error codes. + /// Human-readable representation of the + /// error. + /// Target of the error. + /// Array of details about specific errors that + /// led to this reported error. + /// Object containing more specific + /// information than the current object about the error. + public Error(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), ErrorInnerError innerError = default(ErrorInnerError)) + { + Code = code; + Message = message; + Target = target; + Details = details; + InnerError = innerError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets server-defined set of error codes. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets human-readable representation of the error. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets target of the error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets array of details about specific errors that led to this + /// reported error. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets object containing more specific information than the current + /// object about the error. + /// + [JsonProperty(PropertyName = "innerError")] + public ErrorInnerError InnerError { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..28118d3331d9 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/ErrorDetail.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 000000000000..85a33b35db2f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/ErrorInnerError.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ErrorInnerError.cs new file mode 100644 index 000000000000..8e3817fcdfa5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ErrorInnerError.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Object containing more specific information than the current object + /// about the error. + /// + public partial class ErrorInnerError + { + /// + /// Initializes a new instance of the ErrorInnerError class. + /// + public ErrorInnerError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorInnerError class. + /// + public ErrorInnerError(Error innerError = default(Error)) + { + InnerError = innerError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "innerError")] + public Error InnerError { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ErrorResponse.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..faf390099173 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/ErrorResponseException.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..f5894ec2c33f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/HanaDbProviderInstanceProperties.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/HanaDbProviderInstanceProperties.cs new file mode 100644 index 000000000000..d374e56c975e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/HanaDbProviderInstanceProperties.cs @@ -0,0 +1,145 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the provider properties. + /// + [Newtonsoft.Json.JsonObject("SapHana")] + public partial class HanaDbProviderInstanceProperties : ProviderSpecificProperties + { + /// + /// Initializes a new instance of the HanaDbProviderInstanceProperties + /// class. + /// + public HanaDbProviderInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HanaDbProviderInstanceProperties + /// class. + /// + /// Gets or sets the target virtual machine + /// size. + /// Gets or sets the hana database name. + /// Gets or sets the database sql port. + /// Gets or sets the database instance + /// number. + /// Gets or sets the database user + /// name. + /// Gets or sets the database + /// password. + /// Gets or sets the key vault URI to + /// secret with the database password. + /// Gets or sets the blob URI to SSL + /// certificate for the DB. + /// Gets or sets the hostname(s) + /// in the SSL certificate. + /// Possible values include: 'Disabled', + /// 'RootCertificate', 'ServerCertificate' + /// Gets or sets the SAP System + /// Identifier. + public HanaDbProviderInstanceProperties(string hostname = default(string), string dbName = default(string), string sqlPort = default(string), string instanceNumber = default(string), string dbUsername = default(string), string dbPassword = default(string), string dbPasswordUri = default(string), string sslCertificateUri = default(string), string sslHostNameInCertificate = default(string), string sslPreference = default(string), string sapSid = default(string)) + { + Hostname = hostname; + DbName = dbName; + SqlPort = sqlPort; + InstanceNumber = instanceNumber; + DbUsername = dbUsername; + DbPassword = dbPassword; + DbPasswordUri = dbPasswordUri; + SslCertificateUri = sslCertificateUri; + SslHostNameInCertificate = sslHostNameInCertificate; + SslPreference = sslPreference; + SapSid = sapSid; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the target virtual machine size. + /// + [JsonProperty(PropertyName = "hostname")] + public string Hostname { get; set; } + + /// + /// Gets or sets the hana database name. + /// + [JsonProperty(PropertyName = "dbName")] + public string DbName { get; set; } + + /// + /// Gets or sets the database sql port. + /// + [JsonProperty(PropertyName = "sqlPort")] + public string SqlPort { get; set; } + + /// + /// Gets or sets the database instance number. + /// + [JsonProperty(PropertyName = "instanceNumber")] + public string InstanceNumber { get; set; } + + /// + /// Gets or sets the database user name. + /// + [JsonProperty(PropertyName = "dbUsername")] + public string DbUsername { get; set; } + + /// + /// Gets or sets the database password. + /// + [JsonProperty(PropertyName = "dbPassword")] + public string DbPassword { get; set; } + + /// + /// Gets or sets the key vault URI to secret with the database + /// password. + /// + [JsonProperty(PropertyName = "dbPasswordUri")] + public string DbPasswordUri { get; set; } + + /// + /// Gets or sets the blob URI to SSL certificate for the DB. + /// + [JsonProperty(PropertyName = "sslCertificateUri")] + public string SslCertificateUri { get; set; } + + /// + /// Gets or sets the hostname(s) in the SSL certificate. + /// + [JsonProperty(PropertyName = "sslHostNameInCertificate")] + public string SslHostNameInCertificate { get; set; } + + /// + /// Gets or sets possible values include: 'Disabled', + /// 'RootCertificate', 'ServerCertificate' + /// + [JsonProperty(PropertyName = "sslPreference")] + public string SslPreference { get; set; } + + /// + /// Gets or sets the SAP System Identifier. + /// + [JsonProperty(PropertyName = "sapSid")] + public string SapSid { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Health.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Health.cs new file mode 100644 index 000000000000..6d2f38350e00 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Health.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.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Resource health details + /// + public partial class Health + { + /// + /// Initializes a new instance of the Health class. + /// + public Health() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Health class. + /// + /// Possible values include: 'Healthy', + /// 'Degraded', 'Unavailable', 'Unknown' + /// Reasons impacting health + /// state + public Health(string healthState = default(string), string impactingReasons = default(string)) + { + HealthState = healthState; + ImpactingReasons = impactingReasons; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'Healthy', 'Degraded', + /// 'Unavailable', 'Unknown' + /// + [JsonProperty(PropertyName = "healthState")] + public string HealthState { get; set; } + + /// + /// Gets reasons impacting health state + /// + [JsonProperty(PropertyName = "impactingReasons")] + public string ImpactingReasons { get; private set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Identity.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Identity.cs new file mode 100644 index 000000000000..9aef7ca4731e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/ManagedRGConfiguration.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ManagedRGConfiguration.cs new file mode 100644 index 000000000000..7c2b7eaaf73b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/ManagedServiceIdentity.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ManagedServiceIdentity.cs new file mode 100644 index 000000000000..6001f73f5a9d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ManagedServiceIdentity.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Managed service identity. + /// + public partial class ManagedServiceIdentity + { + /// + /// Initializes a new instance of the ManagedServiceIdentity class. + /// + public ManagedServiceIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedServiceIdentity class. + /// + /// Possible values include: 'None', 'UserAssigned', + /// 'SystemAssigned' + /// The service principal ID of the system + /// assigned identity. This property will only be provided for a system + /// assigned identity. + /// The tenant ID of the system assigned + /// identity. This property will only be provided for a system assigned + /// identity. + public ManagedServiceIdentity(string type, System.Guid? principalId = default(System.Guid?), System.Guid? tenantId = default(System.Guid?), IDictionary userAssignedIdentities = default(IDictionary)) + { + PrincipalId = principalId; + TenantId = tenantId; + UserAssignedIdentities = userAssignedIdentities; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the service principal ID of the system assigned identity. This + /// property will only be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public System.Guid? PrincipalId { get; private set; } + + /// + /// Gets the tenant ID of the system assigned identity. This property + /// will only be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "tenantId")] + public System.Guid? TenantId { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + + /// + /// Gets or sets possible values include: 'None', 'UserAssigned', + /// 'SystemAssigned' + /// + [JsonProperty(PropertyName = "type")] + public string Type { 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.SAPMonitors/src/Generated/Models/ManagedServiceIdentityType.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ManagedServiceIdentityType.cs new file mode 100644 index 000000000000..c42816cb87a6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ManagedServiceIdentityType.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.SAPMonitors.Models +{ + + /// + /// Defines values for ManagedServiceIdentityType. + /// + public static class ManagedServiceIdentityType + { + public const string None = "None"; + public const string UserAssigned = "UserAssigned"; + public const string SystemAssigned = "SystemAssigned"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Monitor.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Monitor.cs new file mode 100644 index 000000000000..90b957b491da --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Monitor.cs @@ -0,0 +1,185 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// SAP monitor info on Azure (ARM properties and SAP monitor properties) + /// + [Rest.Serialization.JsonTransformation] + public partial class Monitor : TrackedResource + { + /// + /// Initializes a new instance of the Monitor class. + /// + public Monitor() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Monitor class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// State of provisioning of the SAP + /// monitor. Possible values include: 'Accepted', 'Creating', + /// 'Updating', 'Failed', 'Succeeded', 'Deleting', 'Migrating', + /// 'Canceled' + /// Defines the SAP monitor errors. + /// The SAP monitor resources will be + /// deployed in the SAP monitoring region. The subnet region should be + /// same as the SAP monitoring region. + /// Sets the routing preference of the + /// SAP monitor. By default only RFC1918 traffic is routed to the + /// customer VNET. Possible values include: 'Default', + /// 'RouteAll' + /// Sets the preference for zone + /// redundancy on resources created for the SAP monitor. By default + /// resources will be created which do not support zone + /// redundancy. + /// Managed resource + /// group configuration + /// The ARM ID of the Log + /// Analytics Workspace that is used for SAP monitoring. + /// The subnet which the SAP monitor will + /// be deployed in + /// The ARM ID of the MSI used for SAP + /// monitoring. + /// The ARM ID of the Storage account + /// used for SAP monitoring. + public Monitor(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), ManagedServiceIdentity identity = default(ManagedServiceIdentity), string provisioningState = default(string), MonitorPropertiesErrors errors = default(MonitorPropertiesErrors), string appLocation = default(string), string routingPreference = default(string), string zoneRedundancyPreference = default(string), ManagedRGConfiguration managedResourceGroupConfiguration = default(ManagedRGConfiguration), string logAnalyticsWorkspaceArmId = default(string), string monitorSubnet = default(string), string msiArmId = default(string), string storageAccountArmId = default(string)) + : base(location, id, name, type, systemData, tags) + { + Identity = identity; + ProvisioningState = provisioningState; + Errors = errors; + AppLocation = appLocation; + RoutingPreference = routingPreference; + ZoneRedundancyPreference = zoneRedundancyPreference; + ManagedResourceGroupConfiguration = managedResourceGroupConfiguration; + LogAnalyticsWorkspaceArmId = logAnalyticsWorkspaceArmId; + MonitorSubnet = monitorSubnet; + MsiArmId = msiArmId; + StorageAccountArmId = storageAccountArmId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "identity")] + public ManagedServiceIdentity Identity { get; set; } + + /// + /// Gets state of provisioning of the SAP monitor. Possible values + /// include: 'Accepted', 'Creating', 'Updating', 'Failed', 'Succeeded', + /// 'Deleting', 'Migrating', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets defines the SAP monitor errors. + /// + [JsonProperty(PropertyName = "properties.errors")] + public MonitorPropertiesErrors Errors { get; private set; } + + /// + /// Gets or sets the SAP monitor resources will be deployed in the SAP + /// monitoring region. The subnet region should be same as the SAP + /// monitoring region. + /// + [JsonProperty(PropertyName = "properties.appLocation")] + public string AppLocation { get; set; } + + /// + /// Gets or sets sets the routing preference of the SAP monitor. By + /// default only RFC1918 traffic is routed to the customer VNET. + /// Possible values include: 'Default', 'RouteAll' + /// + [JsonProperty(PropertyName = "properties.routingPreference")] + public string RoutingPreference { get; set; } + + /// + /// Gets or sets sets the preference for zone redundancy on resources + /// created for the SAP monitor. By default resources will be created + /// which do not support zone redundancy. + /// + [JsonProperty(PropertyName = "properties.zoneRedundancyPreference")] + public string ZoneRedundancyPreference { get; set; } + + /// + /// Gets or sets managed resource group configuration + /// + [JsonProperty(PropertyName = "properties.managedResourceGroupConfiguration")] + public ManagedRGConfiguration ManagedResourceGroupConfiguration { get; set; } + + /// + /// Gets or sets the ARM ID of the Log Analytics Workspace that is used + /// for SAP monitoring. + /// + [JsonProperty(PropertyName = "properties.logAnalyticsWorkspaceArmId")] + public string LogAnalyticsWorkspaceArmId { get; set; } + + /// + /// Gets or sets the subnet which the SAP monitor will be deployed in + /// + [JsonProperty(PropertyName = "properties.monitorSubnet")] + public string MonitorSubnet { get; set; } + + /// + /// Gets the ARM ID of the MSI used for SAP monitoring. + /// + [JsonProperty(PropertyName = "properties.msiArmId")] + public string MsiArmId { get; private set; } + + /// + /// Gets the ARM ID of the Storage account used for SAP monitoring. + /// + [JsonProperty(PropertyName = "properties.storageAccountArmId")] + public string StorageAccountArmId { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Identity != null) + { + Identity.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/MonitorPropertiesErrors.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/MonitorPropertiesErrors.cs new file mode 100644 index 000000000000..dc863f942b8f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/MonitorPropertiesErrors.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the SAP monitor errors. + /// + public partial class MonitorPropertiesErrors : Error + { + /// + /// Initializes a new instance of the MonitorPropertiesErrors class. + /// + public MonitorPropertiesErrors() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MonitorPropertiesErrors class. + /// + /// Server-defined set of error codes. + /// Human-readable representation of the + /// error. + /// Target of the error. + /// Array of details about specific errors that + /// led to this reported error. + /// Object containing more specific + /// information than the current object about the error. + public MonitorPropertiesErrors(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), ErrorInnerError innerError = default(ErrorInnerError)) + : base(code, message, target, details, innerError) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/MonitorsDeleteHeaders.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/MonitorsDeleteHeaders.cs new file mode 100644 index 000000000000..43e4ab240307 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/MonitorsDeleteHeaders.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.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class MonitorsDeleteHeaders + { + /// + /// Initializes a new instance of the MonitorsDeleteHeaders class. + /// + public MonitorsDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MonitorsDeleteHeaders class. + /// + public MonitorsDeleteHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/MsSqlServerProviderInstanceProperties.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/MsSqlServerProviderInstanceProperties.cs new file mode 100644 index 000000000000..68ba9dd719e5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/MsSqlServerProviderInstanceProperties.cs @@ -0,0 +1,118 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the SQL server provider properties. + /// + [Newtonsoft.Json.JsonObject("MsSqlServer")] + public partial class MsSqlServerProviderInstanceProperties : ProviderSpecificProperties + { + /// + /// Initializes a new instance of the + /// MsSqlServerProviderInstanceProperties class. + /// + public MsSqlServerProviderInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MsSqlServerProviderInstanceProperties class. + /// + /// Gets or sets the SQL server host + /// name. + /// Gets or sets the database sql port. + /// Gets or sets the database user + /// name. + /// Gets or sets the database + /// password. + /// Gets or sets the key vault URI to + /// secret with the database password. + /// Gets or sets the SAP System Identifier + /// Possible values include: 'Disabled', + /// 'RootCertificate', 'ServerCertificate' + /// Gets or sets the blob URI to SSL + /// certificate for the SQL Database. + public MsSqlServerProviderInstanceProperties(string hostname = default(string), string dbPort = default(string), string dbUsername = default(string), string dbPassword = default(string), string dbPasswordUri = default(string), string sapSid = default(string), string sslPreference = default(string), string sslCertificateUri = default(string)) + { + Hostname = hostname; + DbPort = dbPort; + DbUsername = dbUsername; + DbPassword = dbPassword; + DbPasswordUri = dbPasswordUri; + SapSid = sapSid; + SslPreference = sslPreference; + SslCertificateUri = sslCertificateUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the SQL server host name. + /// + [JsonProperty(PropertyName = "hostname")] + public string Hostname { get; set; } + + /// + /// Gets or sets the database sql port. + /// + [JsonProperty(PropertyName = "dbPort")] + public string DbPort { get; set; } + + /// + /// Gets or sets the database user name. + /// + [JsonProperty(PropertyName = "dbUsername")] + public string DbUsername { get; set; } + + /// + /// Gets or sets the database password. + /// + [JsonProperty(PropertyName = "dbPassword")] + public string DbPassword { get; set; } + + /// + /// Gets or sets the key vault URI to secret with the database + /// password. + /// + [JsonProperty(PropertyName = "dbPasswordUri")] + public string DbPasswordUri { get; set; } + + /// + /// Gets or sets the SAP System Identifier + /// + [JsonProperty(PropertyName = "sapSid")] + public string SapSid { get; set; } + + /// + /// Gets or sets possible values include: 'Disabled', + /// 'RootCertificate', 'ServerCertificate' + /// + [JsonProperty(PropertyName = "sslPreference")] + public string SslPreference { get; set; } + + /// + /// Gets or sets the blob URI to SSL certificate for the SQL Database. + /// + [JsonProperty(PropertyName = "sslCertificateUri")] + public string SslCertificateUri { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Operation.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..a29f1a2cb7e2 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/OperationDisplay.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..78b5f655953e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/OperationProperties.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationProperties.cs new file mode 100644 index 000000000000..91048e9196bf --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationProperties.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + + /// + /// Defines values for OperationProperties. + /// + public static class OperationProperties + { + public const string NotSpecified = "NotSpecified"; + public const string User = "User"; + public const string System = "System"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationsContent.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationsContent.cs new file mode 100644 index 000000000000..b5d929737cf3 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationsContent.cs @@ -0,0 +1,123 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the workload operation content. + /// + [Rest.Serialization.JsonTransformation] + public partial class OperationsContent : IResource + { + /// + /// Initializes a new instance of the OperationsContent class. + /// + public OperationsContent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationsContent class. + /// + /// Name of the operation. + /// Display information of the operation. + /// Indicates whether the operation applies + /// to data-plane. + /// Defines the workload operation origin. + /// Possible values include: 'NotSpecified', 'User', 'System' + /// Defines the action type of workload + /// operation. Possible values include: 'NotSpecified', + /// 'Internal' + /// Defines the workload operation + /// properties. + public OperationsContent(string operationsContentName, OperationsDefinitionDisplay display, bool? isDataAction = default(bool?), string origin = default(string), string actionType = default(string), object properties = default(object)) + { + OperationsContentName = operationsContentName; + IsDataAction = isDataAction; + Origin = origin; + Display = display; + ActionType = actionType; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the operation. + /// + [JsonProperty(PropertyName = "properties.name")] + public string OperationsContentName { get; set; } + + /// + /// Gets or sets indicates whether the operation applies to data-plane. + /// + [JsonProperty(PropertyName = "properties.isDataAction")] + public bool? IsDataAction { get; set; } + + /// + /// Gets or sets defines the workload operation origin. Possible values + /// include: 'NotSpecified', 'User', 'System' + /// + [JsonProperty(PropertyName = "properties.origin")] + public string Origin { get; set; } + + /// + /// Gets or sets display information of the operation. + /// + [JsonProperty(PropertyName = "properties.display")] + public OperationsDefinitionDisplay Display { get; set; } + + /// + /// Gets or sets defines the action type of workload operation. + /// Possible values include: 'NotSpecified', 'Internal' + /// + [JsonProperty(PropertyName = "properties.actionType")] + public string ActionType { get; set; } + + /// + /// Gets or sets defines the workload operation properties. + /// + [JsonProperty(PropertyName = "properties.properties")] + public object Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OperationsContentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperationsContentName"); + } + if (Display == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Display"); + } + if (Display != null) + { + Display.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationsDefinition.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationsDefinition.cs new file mode 100644 index 000000000000..8925464a1f75 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationsDefinition.cs @@ -0,0 +1,120 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of an Operation. + /// + public partial class OperationsDefinition + { + /// + /// Initializes a new instance of the OperationsDefinition class. + /// + public OperationsDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationsDefinition class. + /// + /// Name of the operation. + /// Display information of the operation. + /// Indicates whether the operation applies + /// to data-plane. + /// Defines the workload operation origin. + /// Possible values include: 'NotSpecified', 'User', 'System' + /// Defines the action type of workload + /// operation. Possible values include: 'NotSpecified', + /// 'Internal' + /// Defines the workload operation + /// properties. + public OperationsDefinition(string name, OperationsDefinitionDisplay display, bool? isDataAction = default(bool?), string origin = default(string), string actionType = default(string), object properties = default(object)) + { + Name = name; + IsDataAction = isDataAction; + Origin = origin; + Display = display; + ActionType = actionType; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the operation. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets indicates whether the operation applies to data-plane. + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { get; set; } + + /// + /// Gets or sets defines the workload operation origin. Possible values + /// include: 'NotSpecified', 'User', 'System' + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; set; } + + /// + /// Gets or sets display information of the operation. + /// + [JsonProperty(PropertyName = "display")] + public OperationsDefinitionDisplay Display { get; set; } + + /// + /// Gets or sets defines the action type of workload operation. + /// Possible values include: 'NotSpecified', 'Internal' + /// + [JsonProperty(PropertyName = "actionType")] + public string ActionType { get; set; } + + /// + /// Gets or sets defines the workload operation properties. + /// + [JsonProperty(PropertyName = "properties.properties")] + public object Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Display == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Display"); + } + if (Display != null) + { + Display.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationsDefinitionArrayResponseWithContinuation.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationsDefinitionArrayResponseWithContinuation.cs new file mode 100644 index 000000000000..c49c05a7ce62 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationsDefinitionArrayResponseWithContinuation.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the workload operation definition response. + /// + public partial class OperationsDefinitionArrayResponseWithContinuation + { + /// + /// Initializes a new instance of the + /// OperationsDefinitionArrayResponseWithContinuation class. + /// + public OperationsDefinitionArrayResponseWithContinuation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// OperationsDefinitionArrayResponseWithContinuation class. + /// + /// Defines the workload operation definition + /// response properties. + /// The URL to get to the next set of results, + /// if there are any. + public OperationsDefinitionArrayResponseWithContinuation(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets defines the workload operation definition response + /// properties. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets or sets the URL to get to the next set of results, if there + /// are any. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationsDefinitionDisplay.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationsDefinitionDisplay.cs new file mode 100644 index 000000000000..5822edbd0b34 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationsDefinitionDisplay.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using System.Linq; + + /// + /// Display information of the operation. + /// + public partial class OperationsDefinitionDisplay : OperationsDisplayDefinition + { + /// + /// Initializes a new instance of the OperationsDefinitionDisplay + /// class. + /// + public OperationsDefinitionDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationsDefinitionDisplay + /// class. + /// + /// Defines the workload provider. + /// Defines the workload resource. + /// Defines the workload operation. + /// Describes the workload operation. + public OperationsDefinitionDisplay(string provider, string resource, string operation, string description) + : base(provider, resource, operation, description) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationsDisplayDefinition.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationsDisplayDefinition.cs new file mode 100644 index 000000000000..25ea8f61efbe --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/OperationsDisplayDefinition.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the workload operation. + /// + public partial class OperationsDisplayDefinition + { + /// + /// Initializes a new instance of the OperationsDisplayDefinition + /// class. + /// + public OperationsDisplayDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationsDisplayDefinition + /// class. + /// + /// Defines the workload provider. + /// Defines the workload resource. + /// Defines the workload operation. + /// Describes the workload operation. + public OperationsDisplayDefinition(string provider, string resource, string operation, string description) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets defines the workload provider. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets defines the workload resource. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets defines the workload operation. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets describes the workload operation. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Provider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Provider"); + } + if (Resource == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Resource"); + } + if (Operation == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Operation"); + } + if (Description == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Description"); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Origin.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Origin.cs new file mode 100644 index 000000000000..01490d53fbb8 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/Page.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Page.cs new file mode 100644 index 000000000000..c24b9074db89 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/Plan.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Plan.cs new file mode 100644 index 000000000000..3a93124e4a51 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/PrometheusHaClusterProviderInstanceProperties.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/PrometheusHaClusterProviderInstanceProperties.cs new file mode 100644 index 000000000000..f575aa5a90db --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/PrometheusHaClusterProviderInstanceProperties.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.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the PrometheusHaCluster provider properties. + /// + [Newtonsoft.Json.JsonObject("PrometheusHaCluster")] + public partial class PrometheusHaClusterProviderInstanceProperties : ProviderSpecificProperties + { + /// + /// Initializes a new instance of the + /// PrometheusHaClusterProviderInstanceProperties class. + /// + public PrometheusHaClusterProviderInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrometheusHaClusterProviderInstanceProperties class. + /// + /// URL of the Node Exporter + /// endpoint. + /// Gets or sets the target machine + /// name. + /// Gets or sets the cluster sid. + /// Gets or sets the clusterName. + /// Possible values include: 'Disabled', + /// 'RootCertificate', 'ServerCertificate' + /// Gets or sets the blob URI to SSL + /// certificate for the HA cluster exporter. + public PrometheusHaClusterProviderInstanceProperties(string prometheusUrl = default(string), string hostname = default(string), string sid = default(string), string clusterName = default(string), string sslPreference = default(string), string sslCertificateUri = default(string)) + { + PrometheusUrl = prometheusUrl; + Hostname = hostname; + Sid = sid; + ClusterName = clusterName; + SslPreference = sslPreference; + SslCertificateUri = sslCertificateUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URL of the Node Exporter endpoint. + /// + [JsonProperty(PropertyName = "prometheusUrl")] + public string PrometheusUrl { get; set; } + + /// + /// Gets or sets the target machine name. + /// + [JsonProperty(PropertyName = "hostname")] + public string Hostname { get; set; } + + /// + /// Gets or sets the cluster sid. + /// + [JsonProperty(PropertyName = "sid")] + public string Sid { get; set; } + + /// + /// Gets or sets the clusterName. + /// + [JsonProperty(PropertyName = "clusterName")] + public string ClusterName { get; set; } + + /// + /// Gets or sets possible values include: 'Disabled', + /// 'RootCertificate', 'ServerCertificate' + /// + [JsonProperty(PropertyName = "sslPreference")] + public string SslPreference { get; set; } + + /// + /// Gets or sets the blob URI to SSL certificate for the HA cluster + /// exporter. + /// + [JsonProperty(PropertyName = "sslCertificateUri")] + public string SslCertificateUri { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/PrometheusOSProviderInstanceProperties.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/PrometheusOSProviderInstanceProperties.cs new file mode 100644 index 000000000000..7b4bd19ea88e --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/PrometheusOSProviderInstanceProperties.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.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the PrometheusOS provider properties. + /// + [Newtonsoft.Json.JsonObject("PrometheusOS")] + public partial class PrometheusOSProviderInstanceProperties : ProviderSpecificProperties + { + /// + /// Initializes a new instance of the + /// PrometheusOSProviderInstanceProperties class. + /// + public PrometheusOSProviderInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrometheusOSProviderInstanceProperties class. + /// + /// URL of the Node Exporter + /// endpoint + /// Possible values include: 'Disabled', + /// 'RootCertificate', 'ServerCertificate' + /// Gets or sets the blob URI to SSL + /// certificate for the prometheus node exporter. + /// Gets or sets the SAP System Identifier + public PrometheusOSProviderInstanceProperties(string prometheusUrl = default(string), string sslPreference = default(string), string sslCertificateUri = default(string), string sapSid = default(string)) + { + PrometheusUrl = prometheusUrl; + SslPreference = sslPreference; + SslCertificateUri = sslCertificateUri; + SapSid = sapSid; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URL of the Node Exporter endpoint + /// + [JsonProperty(PropertyName = "prometheusUrl")] + public string PrometheusUrl { get; set; } + + /// + /// Gets or sets possible values include: 'Disabled', + /// 'RootCertificate', 'ServerCertificate' + /// + [JsonProperty(PropertyName = "sslPreference")] + public string SslPreference { get; set; } + + /// + /// Gets or sets the blob URI to SSL certificate for the prometheus + /// node exporter. + /// + [JsonProperty(PropertyName = "sslCertificateUri")] + public string SslCertificateUri { get; set; } + + /// + /// Gets or sets the SAP System Identifier + /// + [JsonProperty(PropertyName = "sapSid")] + public string SapSid { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ProviderInstance.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ProviderInstance.cs new file mode 100644 index 000000000000..a881ed073bfc --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ProviderInstance.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.SAPMonitors.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A provider instance associated with SAP monitor. + /// + [Rest.Serialization.JsonTransformation] + public partial class ProviderInstance : ProxyResource + { + /// + /// Initializes a new instance of the ProviderInstance class. + /// + public ProviderInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProviderInstance class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// State of provisioning of the + /// provider instance. Possible values include: 'Accepted', 'Creating', + /// 'Updating', 'Failed', 'Succeeded', 'Deleting', 'Migrating', + /// 'Canceled' + /// Resource health details + /// Defines the provider instance errors. + /// Defines the provider specific + /// properties. + public ProviderInstance(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string provisioningState = default(string), Health health = default(Health), ProviderInstancePropertiesErrors errors = default(ProviderInstancePropertiesErrors), ProviderSpecificProperties providerSettings = default(ProviderSpecificProperties)) + : base(id, name, type, systemData) + { + ProvisioningState = provisioningState; + Health = health; + Errors = errors; + ProviderSettings = providerSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets state of provisioning of the provider instance. Possible + /// values include: 'Accepted', 'Creating', 'Updating', 'Failed', + /// 'Succeeded', 'Deleting', 'Migrating', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets resource health details + /// + [JsonProperty(PropertyName = "properties.health")] + public Health Health { get; private set; } + + /// + /// Gets defines the provider instance errors. + /// + [JsonProperty(PropertyName = "properties.errors")] + public ProviderInstancePropertiesErrors Errors { get; private set; } + + /// + /// Gets or sets defines the provider specific properties. + /// + [JsonProperty(PropertyName = "properties.providerSettings")] + public ProviderSpecificProperties ProviderSettings { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ProviderInstancePropertiesErrors.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ProviderInstancePropertiesErrors.cs new file mode 100644 index 000000000000..a55b06474389 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ProviderInstancePropertiesErrors.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the provider instance errors. + /// + public partial class ProviderInstancePropertiesErrors : Error + { + /// + /// Initializes a new instance of the ProviderInstancePropertiesErrors + /// class. + /// + public ProviderInstancePropertiesErrors() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProviderInstancePropertiesErrors + /// class. + /// + /// Server-defined set of error codes. + /// Human-readable representation of the + /// error. + /// Target of the error. + /// Array of details about specific errors that + /// led to this reported error. + /// Object containing more specific + /// information than the current object about the error. + public ProviderInstancePropertiesErrors(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), ErrorInnerError innerError = default(ErrorInnerError)) + : base(code, message, target, details, innerError) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ProviderInstancesDeleteHeaders.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ProviderInstancesDeleteHeaders.cs new file mode 100644 index 000000000000..794d38da30b3 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ProviderInstancesDeleteHeaders.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.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class ProviderInstancesDeleteHeaders + { + /// + /// Initializes a new instance of the ProviderInstancesDeleteHeaders + /// class. + /// + public ProviderInstancesDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProviderInstancesDeleteHeaders + /// class. + /// + public ProviderInstancesDeleteHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ProviderSpecificProperties.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ProviderSpecificProperties.cs new file mode 100644 index 000000000000..02711829ef9d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ProviderSpecificProperties.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using System.Linq; + + /// + /// Gets or sets the provider specific properties. + /// + public partial class ProviderSpecificProperties + { + /// + /// Initializes a new instance of the ProviderSpecificProperties class. + /// + public ProviderSpecificProperties() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ProxyResource.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..f8e5f6c5fc02 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/Resource.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Resource.cs new file mode 100644 index 000000000000..75e2a495636d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/ResourceIdentityType.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 000000000000..705052cccbcf --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/ResourceModelWithAllowedPropertySet.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ResourceModelWithAllowedPropertySet.cs new file mode 100644 index 000000000000..47ca7f8d77e4 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs new file mode 100644 index 000000000000..96d493ea980d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs new file mode 100644 index 000000000000..614301d728e0 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs new file mode 100644 index 000000000000..737695cf40dd --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/RoutingPreference.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/RoutingPreference.cs new file mode 100644 index 000000000000..5554abf6cc2b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/RoutingPreference.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + + /// + /// Defines values for RoutingPreference. + /// + public static class RoutingPreference + { + public const string Default = "Default"; + public const string RouteAll = "RouteAll"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitor.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitor.cs new file mode 100644 index 000000000000..1fcb797a61b0 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitor.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.SAPMonitors.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// configuration associated with SAP Landscape Monitor Dashboard. + /// + [Rest.Serialization.JsonTransformation] + public partial class SapLandscapeMonitor : ProxyResource + { + /// + /// Initializes a new instance of the SapLandscapeMonitor class. + /// + public SapLandscapeMonitor() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SapLandscapeMonitor class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// State of provisioning of the SAP + /// monitor. Possible values include: 'Accepted', 'Created', 'Failed', + /// 'Succeeded', 'Canceled' + /// Gets or sets the SID groupings by landscape + /// and Environment. + /// Gets or sets the list Top Metric + /// Thresholds for SAP Landscape Monitor Dashboard + public SapLandscapeMonitor(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string provisioningState = default(string), SapLandscapeMonitorPropertiesGrouping grouping = default(SapLandscapeMonitorPropertiesGrouping), IList topMetricsThresholds = default(IList)) + : base(id, name, type, systemData) + { + ProvisioningState = provisioningState; + Grouping = grouping; + TopMetricsThresholds = topMetricsThresholds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets state of provisioning of the SAP monitor. Possible values + /// include: 'Accepted', 'Created', 'Failed', 'Succeeded', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the SID groupings by landscape and Environment. + /// + [JsonProperty(PropertyName = "properties.grouping")] + public SapLandscapeMonitorPropertiesGrouping Grouping { get; set; } + + /// + /// Gets or sets the list Top Metric Thresholds for SAP Landscape + /// Monitor Dashboard + /// + [JsonProperty(PropertyName = "properties.topMetricsThresholds")] + public IList TopMetricsThresholds { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitorListResult.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitorListResult.cs new file mode 100644 index 000000000000..05d66624c9ed --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitorListResult.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.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response from the List SAP Landscape Monitor Dashboard operation. + /// + public partial class SapLandscapeMonitorListResult + { + /// + /// Initializes a new instance of the SapLandscapeMonitorListResult + /// class. + /// + public SapLandscapeMonitorListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SapLandscapeMonitorListResult + /// class. + /// + /// The list of Sap Landscape Monitor + /// configuration. + /// The URL to get the next set of SAP Landscape + /// Monitor Dashboard. + public SapLandscapeMonitorListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of Sap Landscape Monitor configuration. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets or sets the URL to get the next set of SAP Landscape Monitor + /// Dashboard. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitorMetricThresholds.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitorMetricThresholds.cs new file mode 100644 index 000000000000..04ecdae856d5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitorMetricThresholds.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gets or sets the Threshold Values for Top Metrics Health. + /// + public partial class SapLandscapeMonitorMetricThresholds + { + /// + /// Initializes a new instance of the + /// SapLandscapeMonitorMetricThresholds class. + /// + public SapLandscapeMonitorMetricThresholds() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SapLandscapeMonitorMetricThresholds class. + /// + /// Gets or sets the name of the threshold. + /// Gets or sets the threshold value for + /// Green. + /// Gets or sets the threshold value for + /// Yellow. + /// Gets or sets the threshold value for Red. + public SapLandscapeMonitorMetricThresholds(string name = default(string), double? green = default(double?), double? yellow = default(double?), double? red = default(double?)) + { + Name = name; + Green = green; + Yellow = yellow; + Red = red; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the threshold. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the threshold value for Green. + /// + [JsonProperty(PropertyName = "green")] + public double? Green { get; set; } + + /// + /// Gets or sets the threshold value for Yellow. + /// + [JsonProperty(PropertyName = "yellow")] + public double? Yellow { get; set; } + + /// + /// Gets or sets the threshold value for Red. + /// + [JsonProperty(PropertyName = "red")] + public double? Red { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitorPropertiesGrouping.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitorPropertiesGrouping.cs new file mode 100644 index 000000000000..f15b0229b9ec --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitorPropertiesGrouping.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Gets or sets the SID groupings by landscape and Environment. + /// + public partial class SapLandscapeMonitorPropertiesGrouping + { + /// + /// Initializes a new instance of the + /// SapLandscapeMonitorPropertiesGrouping class. + /// + public SapLandscapeMonitorPropertiesGrouping() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SapLandscapeMonitorPropertiesGrouping class. + /// + /// Gets or sets the list of landscape to SID + /// mappings. + /// Gets or sets the list of Sap + /// Applications to SID mappings. + public SapLandscapeMonitorPropertiesGrouping(IList landscape = default(IList), IList sapApplication = default(IList)) + { + Landscape = landscape; + SapApplication = sapApplication; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of landscape to SID mappings. + /// + [JsonProperty(PropertyName = "landscape")] + public IList Landscape { get; set; } + + /// + /// Gets or sets the list of Sap Applications to SID mappings. + /// + [JsonProperty(PropertyName = "sapApplication")] + public IList SapApplication { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitorProvisioningState.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitorProvisioningState.cs new file mode 100644 index 000000000000..4b0be98514d2 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitorProvisioningState.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + + /// + /// Defines values for SapLandscapeMonitorProvisioningState. + /// + public static class SapLandscapeMonitorProvisioningState + { + public const string Accepted = "Accepted"; + public const string Created = "Created"; + public const string Failed = "Failed"; + public const string Succeeded = "Succeeded"; + public const string Canceled = "Canceled"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitorSidMapping.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitorSidMapping.cs new file mode 100644 index 000000000000..fba229ffd5ba --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapLandscapeMonitorSidMapping.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.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Gets or sets the mapping for SID to Environment/Applications. + /// + public partial class SapLandscapeMonitorSidMapping + { + /// + /// Initializes a new instance of the SapLandscapeMonitorSidMapping + /// class. + /// + public SapLandscapeMonitorSidMapping() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SapLandscapeMonitorSidMapping + /// class. + /// + /// Gets or sets the name of the grouping. + /// Gets or sets the list of SID's. + public SapLandscapeMonitorSidMapping(string name = default(string), IList topSid = default(IList)) + { + Name = name; + TopSid = topSid; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the grouping. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the list of SID's. + /// + [JsonProperty(PropertyName = "topSid")] + public IList TopSid { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapNetWeaverProviderInstanceProperties.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapNetWeaverProviderInstanceProperties.cs new file mode 100644 index 000000000000..628d15458646 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SapNetWeaverProviderInstanceProperties.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.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Gets or sets the provider properties. + /// + [Newtonsoft.Json.JsonObject("SapNetWeaver")] + public partial class SapNetWeaverProviderInstanceProperties : ProviderSpecificProperties + { + /// + /// Initializes a new instance of the + /// SapNetWeaverProviderInstanceProperties class. + /// + public SapNetWeaverProviderInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SapNetWeaverProviderInstanceProperties class. + /// + /// Gets or sets the SAP System Identifier + /// Gets or sets the target virtual machine + /// IP Address/FQDN. + /// Gets or sets the instance number of SAP + /// NetWeaver. + /// Gets or sets the list of HostFile + /// Entries + /// Gets or sets the SAP user name. + /// Sets the SAP password. + /// Gets or sets the key vault URI to + /// secret with the SAP password. + /// Gets or sets the SAP Client ID. + /// Gets or sets the SAP HTTP port + /// number. + /// Gets or sets the blob URI to SSL + /// certificate for the SAP system. + /// Possible values include: 'Disabled', + /// 'RootCertificate', 'ServerCertificate' + public SapNetWeaverProviderInstanceProperties(string sapSid = default(string), string sapHostname = default(string), string sapInstanceNr = default(string), IList sapHostFileEntries = default(IList), string sapUsername = default(string), string sapPassword = default(string), string sapPasswordUri = default(string), string sapClientId = default(string), string sapPortNumber = default(string), string sslCertificateUri = default(string), string sslPreference = default(string)) + { + SapSid = sapSid; + SapHostname = sapHostname; + SapInstanceNr = sapInstanceNr; + SapHostFileEntries = sapHostFileEntries; + SapUsername = sapUsername; + SapPassword = sapPassword; + SapPasswordUri = sapPasswordUri; + SapClientId = sapClientId; + SapPortNumber = sapPortNumber; + SslCertificateUri = sslCertificateUri; + SslPreference = sslPreference; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the SAP System Identifier + /// + [JsonProperty(PropertyName = "sapSid")] + public string SapSid { get; set; } + + /// + /// Gets or sets the target virtual machine IP Address/FQDN. + /// + [JsonProperty(PropertyName = "sapHostname")] + public string SapHostname { get; set; } + + /// + /// Gets or sets the instance number of SAP NetWeaver. + /// + [JsonProperty(PropertyName = "sapInstanceNr")] + public string SapInstanceNr { get; set; } + + /// + /// Gets or sets the list of HostFile Entries + /// + [JsonProperty(PropertyName = "sapHostFileEntries")] + public IList SapHostFileEntries { get; set; } + + /// + /// Gets or sets the SAP user name. + /// + [JsonProperty(PropertyName = "sapUsername")] + public string SapUsername { get; set; } + + /// + /// Gets or sets sets the SAP password. + /// + [JsonProperty(PropertyName = "sapPassword")] + public string SapPassword { get; set; } + + /// + /// Gets or sets the key vault URI to secret with the SAP password. + /// + [JsonProperty(PropertyName = "sapPasswordUri")] + public string SapPasswordUri { get; set; } + + /// + /// Gets or sets the SAP Client ID. + /// + [JsonProperty(PropertyName = "sapClientId")] + public string SapClientId { get; set; } + + /// + /// Gets or sets the SAP HTTP port number. + /// + [JsonProperty(PropertyName = "sapPortNumber")] + public string SapPortNumber { get; set; } + + /// + /// Gets or sets the blob URI to SSL certificate for the SAP system. + /// + [JsonProperty(PropertyName = "sslCertificateUri")] + public string SslCertificateUri { get; set; } + + /// + /// Gets or sets possible values include: 'Disabled', + /// 'RootCertificate', 'ServerCertificate' + /// + [JsonProperty(PropertyName = "sslPreference")] + public string SslPreference { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Sku.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Sku.cs new file mode 100644 index 000000000000..0641d2aea600 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/SkuTier.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SkuTier.cs new file mode 100644 index 000000000000..34545dad1ea5 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/SslPreference.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SslPreference.cs new file mode 100644 index 000000000000..66a7864bffa6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SslPreference.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.SAPMonitors.Models +{ + + /// + /// Defines values for SslPreference. + /// + public static class SslPreference + { + public const string Disabled = "Disabled"; + public const string RootCertificate = "RootCertificate"; + public const string ServerCertificate = "ServerCertificate"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SystemData.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..9bfba0a9e7c6 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/Tags.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Tags.cs new file mode 100644 index 000000000000..0ed0dc521aaa --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/Tags.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Tags field of the resource. + /// + public partial class Tags + { + /// + /// Initializes a new instance of the Tags class. + /// + public Tags() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Tags class. + /// + /// Tags field of the resource. + public Tags(IDictionary tagsProperty = default(IDictionary)) + { + TagsProperty = tagsProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets tags field of the resource. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary TagsProperty { get; set; } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/TrackedResource.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/TrackedResource.cs new file mode 100644 index 000000000000..0ffc4c0fee5d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/UpdateMonitorRequest.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/UpdateMonitorRequest.cs new file mode 100644 index 000000000000..c7fc40ed94ee --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/UpdateMonitorRequest.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines the request body for updating SAP monitor resource. + /// + public partial class UpdateMonitorRequest + { + /// + /// Initializes a new instance of the UpdateMonitorRequest class. + /// + public UpdateMonitorRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateMonitorRequest class. + /// + /// Gets or sets the Resource tags. + public UpdateMonitorRequest(IDictionary tags = default(IDictionary), ManagedServiceIdentity identity = default(ManagedServiceIdentity)) + { + Tags = tags; + Identity = identity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "identity")] + public ManagedServiceIdentity Identity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Identity != null) + { + Identity.Validate(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/UserAssignedIdentity.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/UserAssignedIdentity.cs new file mode 100644 index 000000000000..34a23eae1375 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors.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.SAPMonitors/src/Generated/Models/WorkloadMonitorActionType.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/WorkloadMonitorActionType.cs new file mode 100644 index 000000000000..7bae6fd7f92b --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/WorkloadMonitorActionType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + + /// + /// Defines values for WorkloadMonitorActionType. + /// + public static class WorkloadMonitorActionType + { + public const string NotSpecified = "NotSpecified"; + public const string Internal = "Internal"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/WorkloadMonitorProvisioningState.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/WorkloadMonitorProvisioningState.cs new file mode 100644 index 000000000000..699018a0a846 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/WorkloadMonitorProvisioningState.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors.Models +{ + + /// + /// Defines values for WorkloadMonitorProvisioningState. + /// + public static class WorkloadMonitorProvisioningState + { + public const string Accepted = "Accepted"; + public const string Creating = "Creating"; + public const string Updating = "Updating"; + public const string Failed = "Failed"; + public const string Succeeded = "Succeeded"; + public const string Deleting = "Deleting"; + public const string Migrating = "Migrating"; + public const string Canceled = "Canceled"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/WorkloadProviderInstanceHealthState.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/WorkloadProviderInstanceHealthState.cs new file mode 100644 index 000000000000..100e3cb92aa2 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Models/WorkloadProviderInstanceHealthState.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.SAPMonitors.Models +{ + + /// + /// Defines values for WorkloadProviderInstanceHealthState. + /// + public static class WorkloadProviderInstanceHealthState + { + public const string Healthy = "Healthy"; + public const string Degraded = "Degraded"; + public const string Unavailable = "Unavailable"; + public const string Unknown = "Unknown"; + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/MonitorsOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/MonitorsOperations.cs new file mode 100644 index 000000000000..7b86b4840368 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/MonitorsOperations.cs @@ -0,0 +1,1803 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MonitorsOperations operations. + /// + internal partial class MonitorsOperations : IServiceOperations, IMonitorsOperations + { + /// + /// Initializes a new instance of the MonitorsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MonitorsOperations(WorkloadsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the WorkloadsClient + /// + public WorkloadsClient Client { get; private set; } + + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The operations + /// returns various properties of each SAP monitor. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Workloads/monitors").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets properties of a SAP monitor. + /// + /// + /// Gets properties of a SAP monitor for the specified subscription, resource + /// group, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (monitorName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(monitorName, "^[a-zA-Z0-9-_]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "monitorName", "^[a-zA-Z0-9-_]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource group, and + /// resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, Monitor monitorParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, monitorName, monitorParameter, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource group, and + /// SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, monitorName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Patches the Tags field of a SAP monitor. + /// + /// + /// Patches the Tags field of a SAP monitor for the specified subscription, + /// resource group, and SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The Update SAP workload monitor request body. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string monitorName, UpdateMonitorRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (monitorName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(monitorName, "^[a-zA-Z0-9-_]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "monitorName", "^[a-zA-Z0-9-_]+$"); + } + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource group, and + /// resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, Monitor monitorParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (monitorName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(monitorName, "^[a-zA-Z0-9-_]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "monitorName", "^[a-zA-Z0-9-_]+$"); + } + } + if (monitorParameter == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorParameter"); + } + if (monitorParameter != null) + { + monitorParameter.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("monitorParameter", monitorParameter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(monitorParameter != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(monitorParameter, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource group, and + /// SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (monitorName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(monitorName, "^[a-zA-Z0-9-_]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "monitorName", "^[a-zA-Z0-9-_]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 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; + } + + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The operations + /// returns various properties of each SAP monitor. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/MonitorsOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/MonitorsOperationsExtensions.cs new file mode 100644 index 000000000000..4b4a0a5a6e28 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/MonitorsOperationsExtensions.cs @@ -0,0 +1,489 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for MonitorsOperations. + /// + public static partial class MonitorsOperationsExtensions + { + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The operations + /// returns various properties of each SAP monitor. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IMonitorsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The operations + /// returns various properties of each SAP monitor. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IMonitorsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this IMonitorsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IMonitorsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets properties of a SAP monitor. + /// + /// + /// Gets properties of a SAP monitor for the specified subscription, resource + /// group, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + public static Monitor Get(this IMonitorsOperations operations, string resourceGroupName, string monitorName) + { + return operations.GetAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// Gets properties of a SAP monitor. + /// + /// + /// Gets properties of a SAP monitor for the specified subscription, resource + /// group, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource group, and + /// resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + public static Monitor Create(this IMonitorsOperations operations, string resourceGroupName, string monitorName, Monitor monitorParameter) + { + return operations.CreateAsync(resourceGroupName, monitorName, monitorParameter).GetAwaiter().GetResult(); + } + + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource group, and + /// resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, Monitor monitorParameter, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, monitorName, monitorParameter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource group, and + /// SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + public static MonitorsDeleteHeaders Delete(this IMonitorsOperations operations, string resourceGroupName, string monitorName) + { + return operations.DeleteAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource group, and + /// SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Patches the Tags field of a SAP monitor. + /// + /// + /// Patches the Tags field of a SAP monitor for the specified subscription, + /// resource group, and SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The Update SAP workload monitor request body. + /// + public static Monitor Update(this IMonitorsOperations operations, string resourceGroupName, string monitorName, UpdateMonitorRequest body) + { + return operations.UpdateAsync(resourceGroupName, monitorName, body).GetAwaiter().GetResult(); + } + + /// + /// Patches the Tags field of a SAP monitor. + /// + /// + /// Patches the Tags field of a SAP monitor for the specified subscription, + /// resource group, and SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The Update SAP workload monitor request body. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, UpdateMonitorRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, monitorName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource group, and + /// resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + public static Monitor BeginCreate(this IMonitorsOperations operations, string resourceGroupName, string monitorName, Monitor monitorParameter) + { + return operations.BeginCreateAsync(resourceGroupName, monitorName, monitorParameter).GetAwaiter().GetResult(); + } + + /// + /// Creates a SAP monitor. + /// + /// + /// Creates a SAP monitor for the specified subscription, resource group, and + /// resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a SAP monitor + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, Monitor monitorParameter, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, monitorName, monitorParameter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource group, and + /// SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + public static MonitorsDeleteHeaders BeginDelete(this IMonitorsOperations operations, string resourceGroupName, string monitorName) + { + return operations.BeginDeleteAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a SAP monitor. + /// + /// + /// Deletes a SAP monitor with the specified subscription, resource group, and + /// SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The operations + /// returns various properties of each SAP monitor. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IMonitorsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of SAP monitors in the specified subscription. + /// + /// + /// Gets a list of SAP monitors in the specified subscription. The operations + /// returns various properties of each SAP monitor. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IMonitorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IMonitorsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of SAP monitors + /// + /// + /// Gets a list of SAP monitors in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IMonitorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Operations.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Operations.cs new file mode 100644 index 000000000000..cf9d7be24f77 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/Operations.cs @@ -0,0 +1,397 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(WorkloadsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the WorkloadsClient + /// + public WorkloadsClient Client { get; private set; } + + /// + /// Lists all the available API operations under this PR + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Workloads/operations").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the available API operations under this PR + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/OperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..e9048cacef0c --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/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.SAPMonitors +{ + 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.SAPMonitors/src/Generated/ProviderInstancesOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/ProviderInstancesOperations.cs new file mode 100644 index 000000000000..24630d884eee --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/ProviderInstancesOperations.cs @@ -0,0 +1,1268 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProviderInstancesOperations operations. + /// + internal partial class ProviderInstancesOperations : IServiceOperations, IProviderInstancesOperations + { + /// + /// Initializes a new instance of the ProviderInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ProviderInstancesOperations(WorkloadsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the WorkloadsClient + /// + public WorkloadsClient Client { get; private set; } + + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (monitorName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(monitorName, "^[a-zA-Z0-9-_]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "monitorName", "^[a-zA-Z0-9-_]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets properties of a provider instance. + /// + /// + /// Gets properties of a provider instance for the specified subscription, + /// resource group, SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (monitorName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(monitorName, "^[a-zA-Z0-9-_]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "monitorName", "^[a-zA-Z0-9-_]+$"); + } + } + if (providerInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "providerInstanceName"); + } + if (providerInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(providerInstanceName, "^[a-zA-Z0-9-]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "providerInstanceName", "^[a-zA-Z0-9-]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("providerInstanceName", providerInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + _url = _url.Replace("{providerInstanceName}", System.Uri.EscapeDataString(providerInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Defines the provider specific properties. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, ProviderSpecificProperties providerSettings = default(ProviderSpecificProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, monitorName, providerInstanceName, providerSettings, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, monitorName, providerInstanceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Defines the provider specific properties. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, ProviderSpecificProperties providerSettings = default(ProviderSpecificProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (monitorName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(monitorName, "^[a-zA-Z0-9-_]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "monitorName", "^[a-zA-Z0-9-_]+$"); + } + } + if (providerInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "providerInstanceName"); + } + if (providerInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(providerInstanceName, "^[a-zA-Z0-9-]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "providerInstanceName", "^[a-zA-Z0-9-]+$"); + } + } + ProviderInstance providerInstanceParameter = new ProviderInstance(); + if (providerSettings != null) + { + providerInstanceParameter.ProviderSettings = providerSettings; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("providerInstanceName", providerInstanceName); + tracingParameters.Add("providerInstanceParameter", providerInstanceParameter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + _url = _url.Replace("{providerInstanceName}", System.Uri.EscapeDataString(providerInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(providerInstanceParameter != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(providerInstanceParameter, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, string providerInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (monitorName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(monitorName, "^[a-zA-Z0-9-_]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "monitorName", "^[a-zA-Z0-9-_]+$"); + } + } + if (providerInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "providerInstanceName"); + } + if (providerInstanceName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(providerInstanceName, "^[a-zA-Z0-9-]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "providerInstanceName", "^[a-zA-Z0-9-]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("providerInstanceName", providerInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + _url = _url.Replace("{providerInstanceName}", System.Uri.EscapeDataString(providerInstanceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 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; + } + + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/ProviderInstancesOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/ProviderInstancesOperationsExtensions.cs new file mode 100644 index 000000000000..5953270699ac --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/ProviderInstancesOperationsExtensions.cs @@ -0,0 +1,397 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ProviderInstancesOperations. + /// + public static partial class ProviderInstancesOperationsExtensions + { + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + public static IPage List(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName) + { + return operations.ListAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets properties of a provider instance. + /// + /// + /// Gets properties of a provider instance for the specified subscription, + /// resource group, SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + public static ProviderInstance Get(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName) + { + return operations.GetAsync(resourceGroupName, monitorName, providerInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets properties of a provider instance. + /// + /// + /// Gets properties of a provider instance for the specified subscription, + /// resource group, SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, monitorName, providerInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Defines the provider specific properties. + /// + public static ProviderInstance Create(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName, ProviderSpecificProperties providerSettings = default(ProviderSpecificProperties)) + { + return operations.CreateAsync(resourceGroupName, monitorName, providerInstanceName, providerSettings).GetAwaiter().GetResult(); + } + + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Defines the provider specific properties. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName, ProviderSpecificProperties providerSettings = default(ProviderSpecificProperties), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, monitorName, providerInstanceName, providerSettings, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + public static ProviderInstancesDeleteHeaders Delete(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName) + { + return operations.DeleteAsync(resourceGroupName, monitorName, providerInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, monitorName, providerInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Defines the provider specific properties. + /// + public static ProviderInstance BeginCreate(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName, ProviderSpecificProperties providerSettings = default(ProviderSpecificProperties)) + { + return operations.BeginCreateAsync(resourceGroupName, monitorName, providerInstanceName, providerSettings).GetAwaiter().GetResult(); + } + + /// + /// Creates a provider instance. + /// + /// + /// Creates a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// Defines the provider specific properties. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName, ProviderSpecificProperties providerSettings = default(ProviderSpecificProperties), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, monitorName, providerInstanceName, providerSettings, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + public static ProviderInstancesDeleteHeaders BeginDelete(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName) + { + return operations.BeginDeleteAsync(resourceGroupName, monitorName, providerInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a provider instance. + /// + /// + /// Deletes a provider instance for the specified subscription, resource group, + /// SAP monitor name, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Name of the provider instance. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IProviderInstancesOperations operations, string resourceGroupName, string monitorName, string providerInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, monitorName, providerInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IProviderInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of provider instances in the specified SAP monitor. + /// + /// + /// Gets a list of provider instances in the specified SAP monitor. The + /// operations returns various properties of each provider instances. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IProviderInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/SapLandscapeMonitorOperations.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/SapLandscapeMonitorOperations.cs new file mode 100644 index 000000000000..8ebe3a717b0d --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/SapLandscapeMonitorOperations.cs @@ -0,0 +1,1216 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors +{ + 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; + + /// + /// SapLandscapeMonitorOperations operations. + /// + internal partial class SapLandscapeMonitorOperations : IServiceOperations, ISapLandscapeMonitorOperations + { + /// + /// Initializes a new instance of the SapLandscapeMonitorOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SapLandscapeMonitorOperations(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 configuration values for Single Pane Of Glass for SAP monitor. + /// + /// + /// Gets configuration values for Single Pane Of Glass for SAP monitor for the + /// specified subscription, resource group, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (monitorName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(monitorName, "^[a-zA-Z0-9-_]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "monitorName", "^[a-zA-Z0-9-_]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates a SAP Landscape Monitor Dashboard. + /// + /// + /// Creates a SAP Landscape Monitor Dashboard for the specified subscription, + /// resource group, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a configuration for Sap Landscape Monitor + /// Dashboard + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, SapLandscapeMonitor sapLandscapeMonitorParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (monitorName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(monitorName, "^[a-zA-Z0-9-_]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "monitorName", "^[a-zA-Z0-9-_]+$"); + } + } + if (sapLandscapeMonitorParameter == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapLandscapeMonitorParameter"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("sapLandscapeMonitorParameter", sapLandscapeMonitorParameter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(sapLandscapeMonitorParameter != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(sapLandscapeMonitorParameter, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a SAP Landscape Monitor Dashboard. + /// + /// + /// Deletes a SAP Landscape Monitor Dashboard with the specified subscription, + /// resource group, and SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (monitorName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(monitorName, "^[a-zA-Z0-9-_]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "monitorName", "^[a-zA-Z0-9-_]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Patches the SAP Landscape Monitor Dashboard. + /// + /// + /// Patches the SAP Landscape Monitor Dashboard for the specified subscription, + /// resource group, and SAP monitor name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a configuration for Sap Landscape Monitor + /// Dashboard + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string monitorName, SapLandscapeMonitor sapLandscapeMonitorParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (monitorName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(monitorName, "^[a-zA-Z0-9-_]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "monitorName", "^[a-zA-Z0-9-_]+$"); + } + } + if (sapLandscapeMonitorParameter == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sapLandscapeMonitorParameter"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("sapLandscapeMonitorParameter", sapLandscapeMonitorParameter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(sapLandscapeMonitorParameter != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(sapLandscapeMonitorParameter, 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; + } + + /// + /// Gets configuration values for Single Pane Of Glass for SAP monitor. + /// + /// + /// Gets configuration values for Single Pane Of Glass for SAP monitor for the + /// specified subscription, resource group, and resource name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (monitorName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(monitorName, "^[a-zA-Z0-9-_]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "monitorName", "^[a-zA-Z0-9-_]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/SapLandscapeMonitorOperationsExtensions.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/SapLandscapeMonitorOperationsExtensions.cs new file mode 100644 index 000000000000..37335f9ed694 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/SapLandscapeMonitorOperationsExtensions.cs @@ -0,0 +1,278 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SapLandscapeMonitorOperations. + /// + public static partial class SapLandscapeMonitorOperationsExtensions + { + /// + /// Gets configuration values for Single Pane Of Glass for SAP monitor. + /// + /// + /// Gets configuration values for Single Pane Of Glass for SAP monitor for the + /// specified subscription, resource group, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + public static SapLandscapeMonitor Get(this ISapLandscapeMonitorOperations operations, string resourceGroupName, string monitorName) + { + return operations.GetAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// Gets configuration values for Single Pane Of Glass for SAP monitor. + /// + /// + /// Gets configuration values for Single Pane Of Glass for SAP monitor for the + /// specified subscription, resource group, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISapLandscapeMonitorOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a SAP Landscape Monitor Dashboard. + /// + /// + /// Creates a SAP Landscape Monitor Dashboard for the specified subscription, + /// resource group, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a configuration for Sap Landscape Monitor + /// Dashboard + /// + public static SapLandscapeMonitor Create(this ISapLandscapeMonitorOperations operations, string resourceGroupName, string monitorName, SapLandscapeMonitor sapLandscapeMonitorParameter) + { + return operations.CreateAsync(resourceGroupName, monitorName, sapLandscapeMonitorParameter).GetAwaiter().GetResult(); + } + + /// + /// Creates a SAP Landscape Monitor Dashboard. + /// + /// + /// Creates a SAP Landscape Monitor Dashboard for the specified subscription, + /// resource group, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a configuration for Sap Landscape Monitor + /// Dashboard + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISapLandscapeMonitorOperations operations, string resourceGroupName, string monitorName, SapLandscapeMonitor sapLandscapeMonitorParameter, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, monitorName, sapLandscapeMonitorParameter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a SAP Landscape Monitor Dashboard. + /// + /// + /// Deletes a SAP Landscape Monitor Dashboard with the specified subscription, + /// resource group, and SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + public static void Delete(this ISapLandscapeMonitorOperations operations, string resourceGroupName, string monitorName) + { + operations.DeleteAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a SAP Landscape Monitor Dashboard. + /// + /// + /// Deletes a SAP Landscape Monitor Dashboard with the specified subscription, + /// resource group, and SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISapLandscapeMonitorOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Patches the SAP Landscape Monitor Dashboard. + /// + /// + /// Patches the SAP Landscape Monitor Dashboard for the specified subscription, + /// resource group, and SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a configuration for Sap Landscape Monitor + /// Dashboard + /// + public static SapLandscapeMonitor Update(this ISapLandscapeMonitorOperations operations, string resourceGroupName, string monitorName, SapLandscapeMonitor sapLandscapeMonitorParameter) + { + return operations.UpdateAsync(resourceGroupName, monitorName, sapLandscapeMonitorParameter).GetAwaiter().GetResult(); + } + + /// + /// Patches the SAP Landscape Monitor Dashboard. + /// + /// + /// Patches the SAP Landscape Monitor Dashboard for the specified subscription, + /// resource group, and SAP monitor name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// Request body representing a configuration for Sap Landscape Monitor + /// Dashboard + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISapLandscapeMonitorOperations operations, string resourceGroupName, string monitorName, SapLandscapeMonitor sapLandscapeMonitorParameter, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, monitorName, sapLandscapeMonitorParameter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets configuration values for Single Pane Of Glass for SAP monitor. + /// + /// + /// Gets configuration values for Single Pane Of Glass for SAP monitor for the + /// specified subscription, resource group, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + public static SapLandscapeMonitorListResult List(this ISapLandscapeMonitorOperations operations, string resourceGroupName, string monitorName) + { + return operations.ListAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// Gets configuration values for Single Pane Of Glass for SAP monitor. + /// + /// + /// Gets configuration values for Single Pane Of Glass for SAP monitor for the + /// specified subscription, resource group, and resource name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the SAP monitor resource. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this ISapLandscapeMonitorOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/SdkInfo_WorkloadsClient.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/SdkInfo_WorkloadsClient.cs new file mode 100644 index 000000000000..2914970b1e5f --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/SdkInfo_WorkloadsClient.cs @@ -0,0 +1,30 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors +{ + 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", "ProviderInstances", "2023-10-01-preview"), + new Tuple("Workloads", "SapLandscapeMonitor", "2023-10-01-preview"), + new Tuple("Workloads", "monitors", "2023-10-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/WorkloadsClient.cs b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/WorkloadsClient.cs new file mode 100644 index 000000000000..c373efc04217 --- /dev/null +++ b/sdk/workloads/Microsoft.Workloads.SAPMonitors/src/Generated/WorkloadsClient.cs @@ -0,0 +1,377 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Workloads.SAPMonitors +{ + 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; + + 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 API version to use for this operation. + /// + public string ApiVersion { get; private 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 IMonitorsOperations. + /// + public virtual IMonitorsOperations Monitors { get; private set; } + + /// + /// Gets the IProviderInstancesOperations. + /// + public virtual IProviderInstancesOperations ProviderInstances { get; private set; } + + /// + /// Gets the ISapLandscapeMonitorOperations. + /// + public virtual ISapLandscapeMonitorOperations SapLandscapeMonitor { 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() + { + Monitors = new MonitorsOperations(this); + ProviderInstances = new ProviderInstancesOperations(this); + SapLandscapeMonitor = new SapLandscapeMonitorOperations(this); + Operations = new Operations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2023-10-01-preview"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("providerType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("providerType")); + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +}