diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/AzureMachineLearningWorkspacesClient.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/AzureMachineLearningWorkspacesClient.cs new file mode 100644 index 000000000000..b111be2c384e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/AzureMachineLearningWorkspacesClient.cs @@ -0,0 +1,545 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// These APIs allow end users to operate on Azure Machine Learning + /// Workspace resources. + /// + public partial class AzureMachineLearningWorkspacesClient : ServiceClient, IAzureMachineLearningWorkspacesClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// The API version to use for this operation. + /// + public string ApiVersion { get; private set; } + + /// + /// The ID of the target subscription. + /// + public string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IWorkspacesOperations. + /// + public virtual IWorkspacesOperations Workspaces { get; private set; } + + /// + /// Gets the IUsagesOperations. + /// + public virtual IUsagesOperations Usages { get; private set; } + + /// + /// Gets the IVirtualMachineSizesOperations. + /// + public virtual IVirtualMachineSizesOperations VirtualMachineSizes { get; private set; } + + /// + /// Gets the IQuotasOperations. + /// + public virtual IQuotasOperations Quotas { get; private set; } + + /// + /// Gets the IComputeOperations. + /// + public virtual IComputeOperations Compute { get; private set; } + + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } + + /// + /// Gets the IWorkspaceConnectionsOperations. + /// + public virtual IWorkspaceConnectionsOperations WorkspaceConnections { get; private set; } + + /// + /// Gets the IBatchEndpointsOperations. + /// + public virtual IBatchEndpointsOperations BatchEndpoints { get; private set; } + + /// + /// Gets the IBatchDeploymentsOperations. + /// + public virtual IBatchDeploymentsOperations BatchDeployments { get; private set; } + + /// + /// Gets the ICodeContainersOperations. + /// + public virtual ICodeContainersOperations CodeContainers { get; private set; } + + /// + /// Gets the ICodeVersionsOperations. + /// + public virtual ICodeVersionsOperations CodeVersions { get; private set; } + + /// + /// Gets the IDataContainersOperations. + /// + public virtual IDataContainersOperations DataContainers { get; private set; } + + /// + /// Gets the IDataVersionsOperations. + /// + public virtual IDataVersionsOperations DataVersions { get; private set; } + + /// + /// Gets the IDatastoresOperations. + /// + public virtual IDatastoresOperations Datastores { get; private set; } + + /// + /// Gets the IEnvironmentContainersOperations. + /// + public virtual IEnvironmentContainersOperations EnvironmentContainers { get; private set; } + + /// + /// Gets the IEnvironmentSpecificationVersionsOperations. + /// + public virtual IEnvironmentSpecificationVersionsOperations EnvironmentSpecificationVersions { get; private set; } + + /// + /// Gets the IJobsOperations. + /// + public virtual IJobsOperations Jobs { get; private set; } + + /// + /// Gets the ILabelingJobsOperations. + /// + public virtual ILabelingJobsOperations LabelingJobs { get; private set; } + + /// + /// Gets the IModelContainersOperations. + /// + public virtual IModelContainersOperations ModelContainers { get; private set; } + + /// + /// Gets the IModelVersionsOperations. + /// + public virtual IModelVersionsOperations ModelVersions { get; private set; } + + /// + /// Gets the IOnlineEndpointsOperations. + /// + public virtual IOnlineEndpointsOperations OnlineEndpoints { get; private set; } + + /// + /// Gets the IOnlineDeploymentsOperations. + /// + public virtual IOnlineDeploymentsOperations OnlineDeployments { get; private set; } + + /// + /// Gets the IWorkspaceFeaturesOperations. + /// + public virtual IWorkspaceFeaturesOperations WorkspaceFeatures { get; private set; } + + /// + /// Gets the IWorkspaceSkusOperations. + /// + public virtual IWorkspaceSkusOperations WorkspaceSkus { get; private set; } + + /// + /// Initializes a new instance of the AzureMachineLearningWorkspacesClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling AzureMachineLearningWorkspacesClient.Dispose(). False: will not dispose provided httpClient + protected AzureMachineLearningWorkspacesClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the AzureMachineLearningWorkspacesClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected AzureMachineLearningWorkspacesClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the AzureMachineLearningWorkspacesClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected AzureMachineLearningWorkspacesClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the AzureMachineLearningWorkspacesClient 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 AzureMachineLearningWorkspacesClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the AzureMachineLearningWorkspacesClient 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 AzureMachineLearningWorkspacesClient(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 AzureMachineLearningWorkspacesClient 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 AzureMachineLearningWorkspacesClient(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 AzureMachineLearningWorkspacesClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling AzureMachineLearningWorkspacesClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public AzureMachineLearningWorkspacesClient(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 AzureMachineLearningWorkspacesClient 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 AzureMachineLearningWorkspacesClient(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 AzureMachineLearningWorkspacesClient 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 AzureMachineLearningWorkspacesClient(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 AzureMachineLearningWorkspacesClient 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 AzureMachineLearningWorkspacesClient(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() + { + Operations = new Operations(this); + Workspaces = new WorkspacesOperations(this); + Usages = new UsagesOperations(this); + VirtualMachineSizes = new VirtualMachineSizesOperations(this); + Quotas = new QuotasOperations(this); + Compute = new ComputeOperations(this); + PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); + PrivateLinkResources = new PrivateLinkResourcesOperations(this); + WorkspaceConnections = new WorkspaceConnectionsOperations(this); + BatchEndpoints = new BatchEndpointsOperations(this); + BatchDeployments = new BatchDeploymentsOperations(this); + CodeContainers = new CodeContainersOperations(this); + CodeVersions = new CodeVersionsOperations(this); + DataContainers = new DataContainersOperations(this); + DataVersions = new DataVersionsOperations(this); + Datastores = new DatastoresOperations(this); + EnvironmentContainers = new EnvironmentContainersOperations(this); + EnvironmentSpecificationVersions = new EnvironmentSpecificationVersionsOperations(this); + Jobs = new JobsOperations(this); + LabelingJobs = new LabelingJobsOperations(this); + ModelContainers = new ModelContainersOperations(this); + ModelVersions = new ModelVersionsOperations(this); + OnlineEndpoints = new OnlineEndpointsOperations(this); + OnlineDeployments = new OnlineDeploymentsOperations(this); + WorkspaceFeatures = new WorkspaceFeaturesOperations(this); + WorkspaceSkus = new WorkspaceSkusOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2021-03-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("computeType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("computeType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("computeType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("computeType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("computeType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("computeType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("referenceType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("referenceType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("credentialsType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("credentialsType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("distributionType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("distributionType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("identityType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("identityType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("contentsType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("contentsType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("secretsType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("secretsType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("dockerSpecificationType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("dockerSpecificationType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("policyType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("policyType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("format")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("format")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("jobType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("jobType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("mediaType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("mediaType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("scaleType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("scaleType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("endpointComputeType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("endpointComputeType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("endpointComputeType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("endpointComputeType")); + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/BatchDeploymentsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/BatchDeploymentsOperations.cs new file mode 100644 index 000000000000..8182d5970ee1 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/BatchDeploymentsOperations.cs @@ -0,0 +1,1464 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// BatchDeploymentsOperations operations. + /// + internal partial class BatchDeploymentsOperations : IServiceOperations, IBatchDeploymentsOperations + { + /// + /// Initializes a new instance of the BatchDeploymentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BatchDeploymentsOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// Lists Batch inference deployments in the workspace. + /// + /// + /// Endpoint name + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Top of list. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 endpointName, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("orderBy", orderBy); + tracingParameters.Add("top", top); + tracingParameters.Add("skip", skip); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (orderBy != null) + { + _queryParameters.Add(string.Format("$orderBy={0}", System.Uri.EscapeDataString(orderBy))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + 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; + } + + /// + /// Delete Batch Inference deployment. + /// + /// + /// Endpoint name + /// + /// + /// Inference deployment identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string deploymentName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Gets a batch inference deployment by id. + /// + /// + /// Endpoint name + /// + /// + /// The identifier for the Batch deployments. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string deploymentName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Update a batch inference deployment. + /// + /// + /// Inference endpoint name + /// + /// + /// The identifier for the Batch inference deployment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Batch inference deployment definition object. + /// + /// + /// 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 endpointName, string deploymentName, string resourceGroupName, string workspaceName, PartialBatchDeploymentPartialTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (endpointName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(endpointName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "endpointName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + 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("endpointName", endpointName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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/updates a batch inference deployment. + /// + /// + /// Inference endpoint name + /// + /// + /// The identifier for the Batch inference deployment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Batch inference deployment definition object. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string endpointName, string deploymentName, string resourceGroupName, string workspaceName, BatchDeploymentTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (endpointName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(endpointName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "endpointName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists Batch inference deployments in the workspace. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/BatchDeploymentsOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/BatchDeploymentsOperationsExtensions.cs new file mode 100644 index 000000000000..4bf9cd2da7e3 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/BatchDeploymentsOperationsExtensions.cs @@ -0,0 +1,340 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BatchDeploymentsOperations. + /// + public static partial class BatchDeploymentsOperationsExtensions + { + /// + /// Lists Batch inference deployments in the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Endpoint name + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Top of list. + /// + /// + /// Continuation token for pagination. + /// + public static IPage List(this IBatchDeploymentsOperations operations, string endpointName, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string)) + { + return operations.ListAsync(endpointName, resourceGroupName, workspaceName, orderBy, top, skip).GetAwaiter().GetResult(); + } + + /// + /// Lists Batch inference deployments in the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Endpoint name + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Top of list. + /// + /// + /// Continuation token for pagination. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IBatchDeploymentsOperations operations, string endpointName, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, orderBy, top, skip, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete Batch Inference deployment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Endpoint name + /// + /// + /// Inference deployment identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void Delete(this IBatchDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName) + { + operations.DeleteAsync(endpointName, deploymentName, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete Batch Inference deployment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Endpoint name + /// + /// + /// Inference deployment identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IBatchDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(endpointName, deploymentName, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a batch inference deployment by id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Endpoint name + /// + /// + /// The identifier for the Batch deployments. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static BatchDeploymentTrackedResource Get(this IBatchDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(endpointName, deploymentName, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a batch inference deployment by id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Endpoint name + /// + /// + /// The identifier for the Batch deployments. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBatchDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(endpointName, deploymentName, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a batch inference deployment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name + /// + /// + /// The identifier for the Batch inference deployment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Batch inference deployment definition object. + /// + public static BatchDeploymentTrackedResource Update(this IBatchDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, PartialBatchDeploymentPartialTrackedResource body) + { + return operations.UpdateAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Update a batch inference deployment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name + /// + /// + /// The identifier for the Batch inference deployment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Batch inference deployment definition object. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IBatchDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, PartialBatchDeploymentPartialTrackedResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates/updates a batch inference deployment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name + /// + /// + /// The identifier for the Batch inference deployment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Batch inference deployment definition object. + /// + public static BatchDeploymentTrackedResource CreateOrUpdate(this IBatchDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, BatchDeploymentTrackedResource body) + { + return operations.CreateOrUpdateAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Creates/updates a batch inference deployment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name + /// + /// + /// The identifier for the Batch inference deployment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Batch inference deployment definition object. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IBatchDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, BatchDeploymentTrackedResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists Batch inference deployments in the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IBatchDeploymentsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists Batch inference deployments in the workspace. + /// + /// + /// 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 IBatchDeploymentsOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/BatchEndpointsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/BatchEndpointsOperations.cs new file mode 100644 index 000000000000..046d31a822e1 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/BatchEndpointsOperations.cs @@ -0,0 +1,1622 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// BatchEndpointsOperations operations. + /// + internal partial class BatchEndpointsOperations : IServiceOperations, IBatchEndpointsOperations + { + /// + /// Initializes a new instance of the BatchEndpointsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BatchEndpointsOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// Lists Batch inference endpoint in the workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Number of endpoints to be retrieved in a page of results. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 workspaceName, int? count = default(int?), string skip = default(string), 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("count", count); + tracingParameters.Add("skip", skip); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (count != null) + { + _queryParameters.Add(string.Format("count={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(count, Client.SerializationSettings).Trim('"')))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + 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; + } + + /// + /// Delete Batch Inference Endpoint. + /// + /// + /// Inference Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Gets a batch inference endpoint by name. + /// + /// + /// Name for the Batch Endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Update a batch inference endpoint. + /// + /// + /// Name for the Batch inference endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Mutable batch inference endpoint definition object. + /// + /// + /// 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 endpointName, string resourceGroupName, string workspaceName, PartialBatchEndpointPartialTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (endpointName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(endpointName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "endpointName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + 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("endpointName", endpointName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 batch inference endpoint. + /// + /// + /// Name for the Batch inference endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Batch inference endpoint definition object. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, BatchEndpointTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (endpointName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(endpointName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "endpointName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists batch Inference Endpoint keys. + /// + /// + /// Inference Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> ListKeysWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListKeys", 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.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/listkeys").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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 Batch inference endpoint in the workspace. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/BatchEndpointsOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/BatchEndpointsOperationsExtensions.cs new file mode 100644 index 000000000000..b2179d18414f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/BatchEndpointsOperationsExtensions.cs @@ -0,0 +1,350 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BatchEndpointsOperations. + /// + public static partial class BatchEndpointsOperationsExtensions + { + /// + /// Lists Batch inference endpoint in the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Number of endpoints to be retrieved in a page of results. + /// + /// + /// Continuation token for pagination. + /// + public static IPage List(this IBatchEndpointsOperations operations, string resourceGroupName, string workspaceName, int? count = default(int?), string skip = default(string)) + { + return operations.ListAsync(resourceGroupName, workspaceName, count, skip).GetAwaiter().GetResult(); + } + + /// + /// Lists Batch inference endpoint in the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Number of endpoints to be retrieved in a page of results. + /// + /// + /// Continuation token for pagination. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IBatchEndpointsOperations operations, string resourceGroupName, string workspaceName, int? count = default(int?), string skip = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, count, skip, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete Batch Inference Endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void Delete(this IBatchEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName) + { + operations.DeleteAsync(endpointName, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete Batch Inference Endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IBatchEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a batch inference endpoint by name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name for the Batch Endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static BatchEndpointTrackedResource Get(this IBatchEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(endpointName, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a batch inference endpoint by name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name for the Batch Endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBatchEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a batch inference endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name for the Batch inference endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Mutable batch inference endpoint definition object. + /// + public static BatchEndpointTrackedResource Update(this IBatchEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, PartialBatchEndpointPartialTrackedResource body) + { + return operations.UpdateAsync(endpointName, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Update a batch inference endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name for the Batch inference endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Mutable batch inference endpoint definition object. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IBatchEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, PartialBatchEndpointPartialTrackedResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a batch inference endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name for the Batch inference endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Batch inference endpoint definition object. + /// + public static BatchEndpointTrackedResource CreateOrUpdate(this IBatchEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, BatchEndpointTrackedResource body) + { + return operations.CreateOrUpdateAsync(endpointName, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Creates a batch inference endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name for the Batch inference endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Batch inference endpoint definition object. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IBatchEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, BatchEndpointTrackedResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists batch Inference Endpoint keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static EndpointAuthKeys ListKeys(this IBatchEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName) + { + return operations.ListKeysAsync(endpointName, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Lists batch Inference Endpoint keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task ListKeysAsync(this IBatchEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListKeysWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists Batch inference endpoint in the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IBatchEndpointsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists Batch inference endpoint in the workspace. + /// + /// + /// 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 IBatchEndpointsOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/CodeContainersOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/CodeContainersOperations.cs new file mode 100644 index 000000000000..65c98bebd37b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/CodeContainersOperations.cs @@ -0,0 +1,1143 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// CodeContainersOperations operations. + /// + internal partial class CodeContainersOperations : IServiceOperations, ICodeContainersOperations + { + /// + /// Initializes a new instance of the CodeContainersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CodeContainersOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// List containers. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 workspaceName, string skip = default(string), 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("skip", skip); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/codes").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + 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; + } + + /// + /// Delete container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/codes/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Get container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/codes/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string name, string resourceGroupName, string workspaceName, CodeContainerResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (name != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(name, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "name", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.MachineLearningServices/workspaces/{workspaceName}/codes/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List containers. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/CodeContainersOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/CodeContainersOperationsExtensions.cs new file mode 100644 index 000000000000..984cbdb60b93 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/CodeContainersOperationsExtensions.cs @@ -0,0 +1,246 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CodeContainersOperations. + /// + public static partial class CodeContainersOperationsExtensions + { + /// + /// List containers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + public static IPage List(this ICodeContainersOperations operations, string resourceGroupName, string workspaceName, string skip = default(string)) + { + return operations.ListAsync(resourceGroupName, workspaceName, skip).GetAwaiter().GetResult(); + } + + /// + /// List containers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ICodeContainersOperations operations, string resourceGroupName, string workspaceName, string skip = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, skip, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void Delete(this ICodeContainersOperations operations, string name, string resourceGroupName, string workspaceName) + { + operations.DeleteAsync(name, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ICodeContainersOperations operations, string name, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(name, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static CodeContainerResource Get(this ICodeContainersOperations operations, string name, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(name, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Get container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICodeContainersOperations operations, string name, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + public static CodeContainerResource CreateOrUpdate(this ICodeContainersOperations operations, string name, string resourceGroupName, string workspaceName, CodeContainerResource body) + { + return operations.CreateOrUpdateAsync(name, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ICodeContainersOperations operations, string name, string resourceGroupName, string workspaceName, CodeContainerResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List containers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ICodeContainersOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List containers. + /// + /// + /// 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 ICodeContainersOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/CodeVersionsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/CodeVersionsOperations.cs new file mode 100644 index 000000000000..09ccb5df3ba1 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/CodeVersionsOperations.cs @@ -0,0 +1,1195 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// CodeVersionsOperations operations. + /// + internal partial class CodeVersionsOperations : IServiceOperations, ICodeVersionsOperations + { + /// + /// Initializes a new instance of the CodeVersionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CodeVersionsOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// List versions. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("orderBy", orderBy); + tracingParameters.Add("top", top); + tracingParameters.Add("skip", skip); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (orderBy != null) + { + _queryParameters.Add(string.Format("$orderBy={0}", System.Uri.EscapeDataString(orderBy))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + 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; + } + + /// + /// Delete version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("version", version); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Get version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("version", version); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Version entity to create or update. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string name, string version, string resourceGroupName, string workspaceName, CodeVersionResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (name != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(name, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "name", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("version", version); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List versions. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/CodeVersionsOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/CodeVersionsOperationsExtensions.cs new file mode 100644 index 000000000000..7dbb9cf47f28 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/CodeVersionsOperationsExtensions.cs @@ -0,0 +1,282 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CodeVersionsOperations. + /// + public static partial class CodeVersionsOperationsExtensions + { + /// + /// List versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Continuation token for pagination. + /// + public static IPage List(this ICodeVersionsOperations operations, string name, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string)) + { + return operations.ListAsync(name, resourceGroupName, workspaceName, orderBy, top, skip).GetAwaiter().GetResult(); + } + + /// + /// List versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Continuation token for pagination. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ICodeVersionsOperations operations, string name, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(name, resourceGroupName, workspaceName, orderBy, top, skip, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void Delete(this ICodeVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName) + { + operations.DeleteAsync(name, version, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ICodeVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(name, version, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static CodeVersionResource Get(this ICodeVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(name, version, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Get version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICodeVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, version, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Version entity to create or update. + /// + public static CodeVersionResource CreateOrUpdate(this ICodeVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, CodeVersionResource body) + { + return operations.CreateOrUpdateAsync(name, version, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Version entity to create or update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ICodeVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, CodeVersionResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, version, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ICodeVersionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List versions. + /// + /// + /// 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 ICodeVersionsOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ComputeOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ComputeOperations.cs new file mode 100644 index 000000000000..c9e5d4dae566 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ComputeOperations.cs @@ -0,0 +1,3000 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// ComputeOperations operations. + /// + internal partial class ComputeOperations : IServiceOperations, IComputeOperations + { + /// + /// Initializes a new instance of the ComputeOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ComputeOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// Gets computes in specified workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 workspaceName, string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("skip", skip); + 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.MachineLearningServices/workspaces/{workspaceName}/computes").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + 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 compute definition by its name. Any secrets (storage keys, service + /// credentials, etc) are not returned - use 'keys' nested resource to get + /// them. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// 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 workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (computeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "computeName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("computeName", computeName); + 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.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{computeName}", System.Uri.EscapeDataString(computeName)); + 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 or updates compute. This call will overwrite a compute if it + /// exists. This is a nonrecoverable operation. If your intent is to create a + /// new compute, do a GET first to verify that it does not exist yet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Payload with Machine Learning compute definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, ComputeResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates properties of a compute. This call will overwrite a compute if it + /// exists. This is a nonrecoverable operation. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Additional parameters for cluster update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, ClusterUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes specified Machine Learning compute. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Delete the underlying compute if 'Delete', or detach the underlying compute + /// from workspace if 'Detach'. Possible values include: 'Delete', 'Detach' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, string underlyingResourceAction, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, underlyingResourceAction, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the details (e.g IP address, port etc) of all the compute nodes in the + /// compute. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// 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>> ListNodesWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (computeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "computeName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("computeName", computeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNodes", 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.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/listNodes").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{computeName}", System.Uri.EscapeDataString(computeName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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 secrets related to Machine Learning compute (storage keys, service + /// credentials, etc). + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// 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> ListKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (computeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "computeName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("computeName", computeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListKeys", 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.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/listKeys").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{computeName}", System.Uri.EscapeDataString(computeName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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; + } + + /// + /// Posts a start action to a compute instance + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Posts a stop action to a compute instance + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StopWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Posts a restart action to a compute instance + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// 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 RestartWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (computeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "computeName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("computeName", computeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Restart", 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.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/restart").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{computeName}", System.Uri.EscapeDataString(computeName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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; + } + + /// + /// Updates schedules of a compute instance + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// The object for updating schedules of specified ComputeInstance. + /// + /// + /// 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 UpdateSchedulesWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, ComputeSchedules parameters = default(ComputeSchedules), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (computeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "computeName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("computeName", computeName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateSchedules", 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.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateSchedules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{computeName}", System.Uri.EscapeDataString(computeName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates compute. This call will overwrite a compute if it + /// exists. This is a nonrecoverable operation. If your intent is to create a + /// new compute, do a GET first to verify that it does not exist yet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Payload with Machine Learning compute definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, ComputeResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (computeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "computeName"); + } + 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 (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("computeName", computeName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{computeName}", System.Uri.EscapeDataString(computeName)); + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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); + } + } + 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; + } + + /// + /// Updates properties of a compute. This call will overwrite a compute if it + /// exists. This is a nonrecoverable operation. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Additional parameters for cluster update. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, ClusterUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (computeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "computeName"); + } + 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 (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("computeName", computeName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{computeName}", System.Uri.EscapeDataString(computeName)); + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes specified Machine Learning compute. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Delete the underlying compute if 'Delete', or detach the underlying compute + /// from workspace if 'Detach'. Possible values include: 'Delete', 'Detach' + /// + /// + /// 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 workspaceName, string computeName, string underlyingResourceAction, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (computeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "computeName"); + } + 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 (underlyingResourceAction == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "underlyingResourceAction"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("computeName", computeName); + tracingParameters.Add("underlyingResourceAction", underlyingResourceAction); + 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.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{computeName}", System.Uri.EscapeDataString(computeName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (underlyingResourceAction != null) + { + _queryParameters.Add(string.Format("underlyingResourceAction={0}", System.Uri.EscapeDataString(underlyingResourceAction))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + 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; + } + + /// + /// Posts a start action to a compute instance + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// 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 BeginStartWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (computeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "computeName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("computeName", computeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStart", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/start").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{computeName}", System.Uri.EscapeDataString(computeName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Posts a stop action to a compute instance + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// 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 BeginStopWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (computeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "computeName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("computeName", computeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStop", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/stop").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{computeName}", System.Uri.EscapeDataString(computeName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets computes in specified workspace. + /// + /// + /// 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; + } + + /// + /// Get the details (e.g IP address, port etc) of all the compute nodes in the + /// compute. + /// + /// + /// 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>> ListNodesNextWithHttpMessagesAsync(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, "ListNodesNext", 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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ComputeOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ComputeOperationsExtensions.cs new file mode 100644 index 000000000000..d4ccf4db0e9b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ComputeOperationsExtensions.cs @@ -0,0 +1,879 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ComputeOperations. + /// + public static partial class ComputeOperationsExtensions + { + /// + /// Gets computes in specified workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + public static IPage List(this IComputeOperations operations, string resourceGroupName, string workspaceName, string skip = default(string)) + { + return operations.ListAsync(resourceGroupName, workspaceName, skip).GetAwaiter().GetResult(); + } + + /// + /// Gets computes in specified workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string skip = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, skip, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets compute definition by its name. Any secrets (storage keys, service + /// credentials, etc) are not returned - use 'keys' nested resource to get + /// them. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + public static ComputeResource Get(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName) + { + return operations.GetAsync(resourceGroupName, workspaceName, computeName).GetAwaiter().GetResult(); + } + + /// + /// Gets compute definition by its name. Any secrets (storage keys, service + /// credentials, etc) are not returned - use 'keys' nested resource to get + /// them. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates compute. This call will overwrite a compute if it + /// exists. This is a nonrecoverable operation. If your intent is to create a + /// new compute, do a GET first to verify that it does not exist yet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Payload with Machine Learning compute definition. + /// + public static ComputeResource CreateOrUpdate(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, ComputeResource parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, computeName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates compute. This call will overwrite a compute if it + /// exists. This is a nonrecoverable operation. If your intent is to create a + /// new compute, do a GET first to verify that it does not exist yet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Payload with Machine Learning compute definition. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, ComputeResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates properties of a compute. This call will overwrite a compute if it + /// exists. This is a nonrecoverable operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Additional parameters for cluster update. + /// + public static ComputeResource Update(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, ClusterUpdateParameters parameters) + { + return operations.UpdateAsync(resourceGroupName, workspaceName, computeName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates properties of a compute. This call will overwrite a compute if it + /// exists. This is a nonrecoverable operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Additional parameters for cluster update. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, ClusterUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes specified Machine Learning compute. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Delete the underlying compute if 'Delete', or detach the underlying compute + /// from workspace if 'Detach'. Possible values include: 'Delete', 'Detach' + /// + public static ComputeDeleteHeaders Delete(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, string underlyingResourceAction) + { + return operations.DeleteAsync(resourceGroupName, workspaceName, computeName, underlyingResourceAction).GetAwaiter().GetResult(); + } + + /// + /// Deletes specified Machine Learning compute. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Delete the underlying compute if 'Delete', or detach the underlying compute + /// from workspace if 'Detach'. Possible values include: 'Delete', 'Detach' + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, string underlyingResourceAction, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, underlyingResourceAction, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Get the details (e.g IP address, port etc) of all the compute nodes in the + /// compute. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + public static IPage ListNodes(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName) + { + return operations.ListNodesAsync(resourceGroupName, workspaceName, computeName).GetAwaiter().GetResult(); + } + + /// + /// Get the details (e.g IP address, port etc) of all the compute nodes in the + /// compute. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNodesAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNodesWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets secrets related to Machine Learning compute (storage keys, service + /// credentials, etc). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + public static ComputeSecrets ListKeys(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName) + { + return operations.ListKeysAsync(resourceGroupName, workspaceName, computeName).GetAwaiter().GetResult(); + } + + /// + /// Gets secrets related to Machine Learning compute (storage keys, service + /// credentials, etc). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// The cancellation token. + /// + public static async Task ListKeysAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListKeysWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Posts a start action to a compute instance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + public static void Start(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName) + { + operations.StartAsync(resourceGroupName, workspaceName, computeName).GetAwaiter().GetResult(); + } + + /// + /// Posts a start action to a compute instance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Posts a stop action to a compute instance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + public static void Stop(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName) + { + operations.StopAsync(resourceGroupName, workspaceName, computeName).GetAwaiter().GetResult(); + } + + /// + /// Posts a stop action to a compute instance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// The cancellation token. + /// + public static async Task StopAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StopWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Posts a restart action to a compute instance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + public static void Restart(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName) + { + operations.RestartAsync(resourceGroupName, workspaceName, computeName).GetAwaiter().GetResult(); + } + + /// + /// Posts a restart action to a compute instance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates schedules of a compute instance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// The object for updating schedules of specified ComputeInstance. + /// + public static void UpdateSchedules(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, ComputeSchedules parameters = default(ComputeSchedules)) + { + operations.UpdateSchedulesAsync(resourceGroupName, workspaceName, computeName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates schedules of a compute instance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// The object for updating schedules of specified ComputeInstance. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateSchedulesAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, ComputeSchedules parameters = default(ComputeSchedules), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateSchedulesWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates compute. This call will overwrite a compute if it + /// exists. This is a nonrecoverable operation. If your intent is to create a + /// new compute, do a GET first to verify that it does not exist yet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Payload with Machine Learning compute definition. + /// + public static ComputeResource BeginCreateOrUpdate(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, ComputeResource parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, workspaceName, computeName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates compute. This call will overwrite a compute if it + /// exists. This is a nonrecoverable operation. If your intent is to create a + /// new compute, do a GET first to verify that it does not exist yet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Payload with Machine Learning compute definition. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, ComputeResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates properties of a compute. This call will overwrite a compute if it + /// exists. This is a nonrecoverable operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Additional parameters for cluster update. + /// + public static ComputeResource BeginUpdate(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, ClusterUpdateParameters parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, workspaceName, computeName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates properties of a compute. This call will overwrite a compute if it + /// exists. This is a nonrecoverable operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Additional parameters for cluster update. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, ClusterUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes specified Machine Learning compute. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Delete the underlying compute if 'Delete', or detach the underlying compute + /// from workspace if 'Detach'. Possible values include: 'Delete', 'Detach' + /// + public static ComputeDeleteHeaders BeginDelete(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, string underlyingResourceAction) + { + return operations.BeginDeleteAsync(resourceGroupName, workspaceName, computeName, underlyingResourceAction).GetAwaiter().GetResult(); + } + + /// + /// Deletes specified Machine Learning compute. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Delete the underlying compute if 'Delete', or detach the underlying compute + /// from workspace if 'Detach'. Possible values include: 'Delete', 'Detach' + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, string underlyingResourceAction, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, underlyingResourceAction, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Posts a start action to a compute instance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + public static void BeginStart(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName) + { + operations.BeginStartAsync(resourceGroupName, workspaceName, computeName).GetAwaiter().GetResult(); + } + + /// + /// Posts a start action to a compute instance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Posts a stop action to a compute instance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + public static void BeginStop(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName) + { + operations.BeginStopAsync(resourceGroupName, workspaceName, computeName).GetAwaiter().GetResult(); + } + + /// + /// Posts a stop action to a compute instance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStopAsync(this IComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStopWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets computes in specified workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IComputeOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets computes in specified workspace. + /// + /// + /// 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 IComputeOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the details (e.g IP address, port etc) of all the compute nodes in the + /// compute. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNodesNext(this IComputeOperations operations, string nextPageLink) + { + return operations.ListNodesNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get the details (e.g IP address, port etc) of all the compute nodes in the + /// compute. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNodesNextAsync(this IComputeOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNodesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DataContainersOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DataContainersOperations.cs new file mode 100644 index 000000000000..f02d3436eb68 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DataContainersOperations.cs @@ -0,0 +1,1143 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// DataContainersOperations operations. + /// + internal partial class DataContainersOperations : IServiceOperations, IDataContainersOperations + { + /// + /// Initializes a new instance of the DataContainersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DataContainersOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// List containers. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 workspaceName, string skip = default(string), 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("skip", skip); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/data").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + 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; + } + + /// + /// Delete container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/data/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Get container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/data/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string name, string resourceGroupName, string workspaceName, DataContainerResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (name != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(name, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "name", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.MachineLearningServices/workspaces/{workspaceName}/data/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List containers. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DataContainersOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DataContainersOperationsExtensions.cs new file mode 100644 index 000000000000..3dfe0373549e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DataContainersOperationsExtensions.cs @@ -0,0 +1,246 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DataContainersOperations. + /// + public static partial class DataContainersOperationsExtensions + { + /// + /// List containers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + public static IPage List(this IDataContainersOperations operations, string resourceGroupName, string workspaceName, string skip = default(string)) + { + return operations.ListAsync(resourceGroupName, workspaceName, skip).GetAwaiter().GetResult(); + } + + /// + /// List containers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDataContainersOperations operations, string resourceGroupName, string workspaceName, string skip = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, skip, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void Delete(this IDataContainersOperations operations, string name, string resourceGroupName, string workspaceName) + { + operations.DeleteAsync(name, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDataContainersOperations operations, string name, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(name, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static DataContainerResource Get(this IDataContainersOperations operations, string name, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(name, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Get container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDataContainersOperations operations, string name, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + public static DataContainerResource CreateOrUpdate(this IDataContainersOperations operations, string name, string resourceGroupName, string workspaceName, DataContainerResource body) + { + return operations.CreateOrUpdateAsync(name, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDataContainersOperations operations, string name, string resourceGroupName, string workspaceName, DataContainerResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List containers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDataContainersOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List containers. + /// + /// + /// 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 IDataContainersOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DataVersionsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DataVersionsOperations.cs new file mode 100644 index 000000000000..9969b593b8c6 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DataVersionsOperations.cs @@ -0,0 +1,1204 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// DataVersionsOperations operations. + /// + internal partial class DataVersionsOperations : IServiceOperations, IDataVersionsOperations + { + /// + /// Initializes a new instance of the DataVersionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DataVersionsOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// List data versions. + /// + /// + /// Data name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Comma-separated list of tag names (and optionally values). Example: + /// tag1,tag2=value2 + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), string tags = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("orderBy", orderBy); + tracingParameters.Add("top", top); + tracingParameters.Add("skip", skip); + tracingParameters.Add("tags", tags); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (orderBy != null) + { + _queryParameters.Add(string.Format("$orderBy={0}", System.Uri.EscapeDataString(orderBy))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + if (tags != null) + { + _queryParameters.Add(string.Format("$tags={0}", System.Uri.EscapeDataString(tags))); + } + 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; + } + + /// + /// Delete version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("version", version); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Get version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("version", version); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Version entity to create or update. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string name, string version, string resourceGroupName, string workspaceName, DataVersionResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (name != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(name, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "name", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("version", version); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List data versions. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DataVersionsOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DataVersionsOperationsExtensions.cs new file mode 100644 index 000000000000..91f8382d3f7c --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DataVersionsOperationsExtensions.cs @@ -0,0 +1,290 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DataVersionsOperations. + /// + public static partial class DataVersionsOperationsExtensions + { + /// + /// List data versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Data name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Comma-separated list of tag names (and optionally values). Example: + /// tag1,tag2=value2 + /// + public static IPage List(this IDataVersionsOperations operations, string name, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), string tags = default(string)) + { + return operations.ListAsync(name, resourceGroupName, workspaceName, orderBy, top, skip, tags).GetAwaiter().GetResult(); + } + + /// + /// List data versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Data name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Comma-separated list of tag names (and optionally values). Example: + /// tag1,tag2=value2 + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDataVersionsOperations operations, string name, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), string tags = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(name, resourceGroupName, workspaceName, orderBy, top, skip, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void Delete(this IDataVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName) + { + operations.DeleteAsync(name, version, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDataVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(name, version, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static DataVersionResource Get(this IDataVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(name, version, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Get version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDataVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, version, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Version entity to create or update. + /// + public static DataVersionResource CreateOrUpdate(this IDataVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, DataVersionResource body) + { + return operations.CreateOrUpdateAsync(name, version, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Version entity to create or update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDataVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, DataVersionResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, version, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List data versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDataVersionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List data versions. + /// + /// + /// 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 IDataVersionsOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DatastoresOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DatastoresOperations.cs new file mode 100644 index 000000000000..51830cc20ab6 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DatastoresOperations.cs @@ -0,0 +1,1424 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// DatastoresOperations operations. + /// + internal partial class DatastoresOperations : IServiceOperations, IDatastoresOperations + { + /// + /// Initializes a new instance of the DatastoresOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DatastoresOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// List datastores. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Maximum number of results to return. + /// + /// + /// Filter down to the workspace default datastore. + /// + /// + /// Names of datastores to return. + /// + /// + /// Text to search for in the datastore names. + /// + /// + /// Order by property (createdtime | modifiedtime | name). + /// + /// + /// Order by property in ascending order. + /// + /// + /// 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 workspaceName, string skip = default(string), int? count = 30, bool? isDefault = default(bool?), IList names = default(IList), string searchText = default(string), string orderBy = default(string), bool? orderByAsc = false, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("skip", skip); + tracingParameters.Add("count", count); + tracingParameters.Add("isDefault", isDefault); + tracingParameters.Add("names", names); + tracingParameters.Add("searchText", searchText); + tracingParameters.Add("orderBy", orderBy); + tracingParameters.Add("orderByAsc", orderByAsc); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/datastores").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + if (count != null) + { + _queryParameters.Add(string.Format("count={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(count, Client.SerializationSettings).Trim('"')))); + } + if (isDefault != null) + { + _queryParameters.Add(string.Format("isDefault={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(isDefault, Client.SerializationSettings).Trim('"')))); + } + if (names != null) + { + _queryParameters.Add(string.Format("names={0}", System.Uri.EscapeDataString(string.Join(",", names)))); + } + if (searchText != null) + { + _queryParameters.Add(string.Format("searchText={0}", System.Uri.EscapeDataString(searchText))); + } + if (orderBy != null) + { + _queryParameters.Add(string.Format("orderBy={0}", System.Uri.EscapeDataString(orderBy))); + } + if (orderByAsc != null) + { + _queryParameters.Add(string.Format("orderByAsc={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(orderByAsc, Client.SerializationSettings).Trim('"')))); + } + 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; + } + + /// + /// Delete datastore. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/datastores/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Get datastore. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/datastores/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update datastore. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Datastore entity to create or update. + /// + /// + /// Flag to skip validation. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string name, string resourceGroupName, string workspaceName, DatastorePropertiesResource body, bool? skipValidation = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (name != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(name, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "name", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("skipValidation", skipValidation); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.MachineLearningServices/workspaces/{workspaceName}/datastores/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (skipValidation != null) + { + _queryParameters.Add(string.Format("skipValidation={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skipValidation, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get datastore secrets. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> ListSecretsWithHttpMessagesAsync(string name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListSecrets", 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.MachineLearningServices/workspaces/{workspaceName}/datastores/{name}/listSecrets").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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; + } + + /// + /// List datastores. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DatastoresOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DatastoresOperationsExtensions.cs new file mode 100644 index 000000000000..3ae85ca353f2 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/DatastoresOperationsExtensions.cs @@ -0,0 +1,336 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatastoresOperations. + /// + public static partial class DatastoresOperationsExtensions + { + /// + /// List datastores. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Maximum number of results to return. + /// + /// + /// Filter down to the workspace default datastore. + /// + /// + /// Names of datastores to return. + /// + /// + /// Text to search for in the datastore names. + /// + /// + /// Order by property (createdtime | modifiedtime | name). + /// + /// + /// Order by property in ascending order. + /// + public static IPage List(this IDatastoresOperations operations, string resourceGroupName, string workspaceName, string skip = default(string), int? count = 30, bool? isDefault = default(bool?), IList names = default(IList), string searchText = default(string), string orderBy = default(string), bool? orderByAsc = false) + { + return operations.ListAsync(resourceGroupName, workspaceName, skip, count, isDefault, names, searchText, orderBy, orderByAsc).GetAwaiter().GetResult(); + } + + /// + /// List datastores. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Maximum number of results to return. + /// + /// + /// Filter down to the workspace default datastore. + /// + /// + /// Names of datastores to return. + /// + /// + /// Text to search for in the datastore names. + /// + /// + /// Order by property (createdtime | modifiedtime | name). + /// + /// + /// Order by property in ascending order. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDatastoresOperations operations, string resourceGroupName, string workspaceName, string skip = default(string), int? count = 30, bool? isDefault = default(bool?), IList names = default(IList), string searchText = default(string), string orderBy = default(string), bool? orderByAsc = false, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, skip, count, isDefault, names, searchText, orderBy, orderByAsc, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete datastore. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void Delete(this IDatastoresOperations operations, string name, string resourceGroupName, string workspaceName) + { + operations.DeleteAsync(name, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete datastore. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDatastoresOperations operations, string name, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(name, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get datastore. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static DatastorePropertiesResource Get(this IDatastoresOperations operations, string name, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(name, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Get datastore. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDatastoresOperations operations, string name, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update datastore. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Datastore entity to create or update. + /// + /// + /// Flag to skip validation. + /// + public static DatastorePropertiesResource CreateOrUpdate(this IDatastoresOperations operations, string name, string resourceGroupName, string workspaceName, DatastorePropertiesResource body, bool? skipValidation = false) + { + return operations.CreateOrUpdateAsync(name, resourceGroupName, workspaceName, body, skipValidation).GetAwaiter().GetResult(); + } + + /// + /// Create or update datastore. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Datastore entity to create or update. + /// + /// + /// Flag to skip validation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDatastoresOperations operations, string name, string resourceGroupName, string workspaceName, DatastorePropertiesResource body, bool? skipValidation = false, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, resourceGroupName, workspaceName, body, skipValidation, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get datastore secrets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static DatastoreSecrets ListSecrets(this IDatastoresOperations operations, string name, string resourceGroupName, string workspaceName) + { + return operations.ListSecretsAsync(name, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Get datastore secrets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task ListSecretsAsync(this IDatastoresOperations operations, string name, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSecretsWithHttpMessagesAsync(name, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List datastores. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDatastoresOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List datastores. + /// + /// + /// 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 IDatastoresOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/EnvironmentContainersOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/EnvironmentContainersOperations.cs new file mode 100644 index 000000000000..a4f5721760d7 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/EnvironmentContainersOperations.cs @@ -0,0 +1,1143 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// EnvironmentContainersOperations operations. + /// + internal partial class EnvironmentContainersOperations : IServiceOperations, IEnvironmentContainersOperations + { + /// + /// Initializes a new instance of the EnvironmentContainersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal EnvironmentContainersOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// List containers. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 workspaceName, string skip = default(string), 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("skip", skip); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/environments").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + 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; + } + + /// + /// Delete container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/environments/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Get container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/environments/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string name, string resourceGroupName, string workspaceName, EnvironmentContainerResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (name != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(name, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "name", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.MachineLearningServices/workspaces/{workspaceName}/environments/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List containers. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/EnvironmentContainersOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/EnvironmentContainersOperationsExtensions.cs new file mode 100644 index 000000000000..f4bec017dd1f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/EnvironmentContainersOperationsExtensions.cs @@ -0,0 +1,246 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for EnvironmentContainersOperations. + /// + public static partial class EnvironmentContainersOperationsExtensions + { + /// + /// List containers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + public static IPage List(this IEnvironmentContainersOperations operations, string resourceGroupName, string workspaceName, string skip = default(string)) + { + return operations.ListAsync(resourceGroupName, workspaceName, skip).GetAwaiter().GetResult(); + } + + /// + /// List containers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IEnvironmentContainersOperations operations, string resourceGroupName, string workspaceName, string skip = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, skip, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void Delete(this IEnvironmentContainersOperations operations, string name, string resourceGroupName, string workspaceName) + { + operations.DeleteAsync(name, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IEnvironmentContainersOperations operations, string name, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(name, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static EnvironmentContainerResource Get(this IEnvironmentContainersOperations operations, string name, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(name, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Get container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IEnvironmentContainersOperations operations, string name, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + public static EnvironmentContainerResource CreateOrUpdate(this IEnvironmentContainersOperations operations, string name, string resourceGroupName, string workspaceName, EnvironmentContainerResource body) + { + return operations.CreateOrUpdateAsync(name, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IEnvironmentContainersOperations operations, string name, string resourceGroupName, string workspaceName, EnvironmentContainerResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List containers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IEnvironmentContainersOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List containers. + /// + /// + /// 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 IEnvironmentContainersOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/EnvironmentSpecificationVersionsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/EnvironmentSpecificationVersionsOperations.cs new file mode 100644 index 000000000000..24ba6949e19e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/EnvironmentSpecificationVersionsOperations.cs @@ -0,0 +1,1195 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// EnvironmentSpecificationVersionsOperations operations. + /// + internal partial class EnvironmentSpecificationVersionsOperations : IServiceOperations, IEnvironmentSpecificationVersionsOperations + { + /// + /// Initializes a new instance of the EnvironmentSpecificationVersionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal EnvironmentSpecificationVersionsOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// List versions. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("orderBy", orderBy); + tracingParameters.Add("top", top); + tracingParameters.Add("skip", skip); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (orderBy != null) + { + _queryParameters.Add(string.Format("$orderBy={0}", System.Uri.EscapeDataString(orderBy))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + 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; + } + + /// + /// Delete version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("version", version); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Get version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("version", version); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 or updates an EnvironmentSpecificationVersion. + /// + /// + /// Name of EnvironmentSpecificationVersion. + /// + /// + /// Version of EnvironmentSpecificationVersion. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Definition of EnvironmentSpecificationVersion. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string name, string version, string resourceGroupName, string workspaceName, EnvironmentSpecificationVersionResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (name != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(name, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "name", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("version", version); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List versions. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/EnvironmentSpecificationVersionsOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/EnvironmentSpecificationVersionsOperationsExtensions.cs new file mode 100644 index 000000000000..b1371dba7528 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/EnvironmentSpecificationVersionsOperationsExtensions.cs @@ -0,0 +1,282 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for EnvironmentSpecificationVersionsOperations. + /// + public static partial class EnvironmentSpecificationVersionsOperationsExtensions + { + /// + /// List versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Continuation token for pagination. + /// + public static IPage List(this IEnvironmentSpecificationVersionsOperations operations, string name, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string)) + { + return operations.ListAsync(name, resourceGroupName, workspaceName, orderBy, top, skip).GetAwaiter().GetResult(); + } + + /// + /// List versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Continuation token for pagination. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IEnvironmentSpecificationVersionsOperations operations, string name, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(name, resourceGroupName, workspaceName, orderBy, top, skip, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void Delete(this IEnvironmentSpecificationVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName) + { + operations.DeleteAsync(name, version, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IEnvironmentSpecificationVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(name, version, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static EnvironmentSpecificationVersionResource Get(this IEnvironmentSpecificationVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(name, version, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Get version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IEnvironmentSpecificationVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, version, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an EnvironmentSpecificationVersion. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of EnvironmentSpecificationVersion. + /// + /// + /// Version of EnvironmentSpecificationVersion. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Definition of EnvironmentSpecificationVersion. + /// + public static EnvironmentSpecificationVersionResource CreateOrUpdate(this IEnvironmentSpecificationVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, EnvironmentSpecificationVersionResource body) + { + return operations.CreateOrUpdateAsync(name, version, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an EnvironmentSpecificationVersion. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of EnvironmentSpecificationVersion. + /// + /// + /// Version of EnvironmentSpecificationVersion. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Definition of EnvironmentSpecificationVersion. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IEnvironmentSpecificationVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, EnvironmentSpecificationVersionResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, version, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IEnvironmentSpecificationVersionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List versions. + /// + /// + /// 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 IEnvironmentSpecificationVersionsOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IAzureMachineLearningWorkspacesClient.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IAzureMachineLearningWorkspacesClient.cs new file mode 100644 index 000000000000..e46b90088aa3 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IAzureMachineLearningWorkspacesClient.cs @@ -0,0 +1,204 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// These APIs allow end users to operate on Azure Machine Learning + /// Workspace resources. + /// + public partial interface IAzureMachineLearningWorkspacesClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// The API version to use for this operation. + /// + string ApiVersion { get; } + + /// + /// The ID of the target subscription. + /// + string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IWorkspacesOperations. + /// + IWorkspacesOperations Workspaces { get; } + + /// + /// Gets the IUsagesOperations. + /// + IUsagesOperations Usages { get; } + + /// + /// Gets the IVirtualMachineSizesOperations. + /// + IVirtualMachineSizesOperations VirtualMachineSizes { get; } + + /// + /// Gets the IQuotasOperations. + /// + IQuotasOperations Quotas { get; } + + /// + /// Gets the IComputeOperations. + /// + IComputeOperations Compute { get; } + + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + IPrivateLinkResourcesOperations PrivateLinkResources { get; } + + /// + /// Gets the IWorkspaceConnectionsOperations. + /// + IWorkspaceConnectionsOperations WorkspaceConnections { get; } + + /// + /// Gets the IBatchEndpointsOperations. + /// + IBatchEndpointsOperations BatchEndpoints { get; } + + /// + /// Gets the IBatchDeploymentsOperations. + /// + IBatchDeploymentsOperations BatchDeployments { get; } + + /// + /// Gets the ICodeContainersOperations. + /// + ICodeContainersOperations CodeContainers { get; } + + /// + /// Gets the ICodeVersionsOperations. + /// + ICodeVersionsOperations CodeVersions { get; } + + /// + /// Gets the IDataContainersOperations. + /// + IDataContainersOperations DataContainers { get; } + + /// + /// Gets the IDataVersionsOperations. + /// + IDataVersionsOperations DataVersions { get; } + + /// + /// Gets the IDatastoresOperations. + /// + IDatastoresOperations Datastores { get; } + + /// + /// Gets the IEnvironmentContainersOperations. + /// + IEnvironmentContainersOperations EnvironmentContainers { get; } + + /// + /// Gets the IEnvironmentSpecificationVersionsOperations. + /// + IEnvironmentSpecificationVersionsOperations EnvironmentSpecificationVersions { get; } + + /// + /// Gets the IJobsOperations. + /// + IJobsOperations Jobs { get; } + + /// + /// Gets the ILabelingJobsOperations. + /// + ILabelingJobsOperations LabelingJobs { get; } + + /// + /// Gets the IModelContainersOperations. + /// + IModelContainersOperations ModelContainers { get; } + + /// + /// Gets the IModelVersionsOperations. + /// + IModelVersionsOperations ModelVersions { get; } + + /// + /// Gets the IOnlineEndpointsOperations. + /// + IOnlineEndpointsOperations OnlineEndpoints { get; } + + /// + /// Gets the IOnlineDeploymentsOperations. + /// + IOnlineDeploymentsOperations OnlineDeployments { get; } + + /// + /// Gets the IWorkspaceFeaturesOperations. + /// + IWorkspaceFeaturesOperations WorkspaceFeatures { get; } + + /// + /// Gets the IWorkspaceSkusOperations. + /// + IWorkspaceSkusOperations WorkspaceSkus { get; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IBatchDeploymentsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IBatchDeploymentsOperations.cs new file mode 100644 index 000000000000..2f00deaed022 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IBatchDeploymentsOperations.cs @@ -0,0 +1,213 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BatchDeploymentsOperations operations. + /// + public partial interface IBatchDeploymentsOperations + { + /// + /// Lists Batch inference deployments in the workspace. + /// + /// + /// Endpoint name + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Top of list. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 endpointName, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete Batch Inference deployment. + /// + /// + /// Endpoint name + /// + /// + /// Inference deployment identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string deploymentName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a batch inference deployment by id. + /// + /// + /// Endpoint name + /// + /// + /// The identifier for the Batch deployments. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string deploymentName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a batch inference deployment. + /// + /// + /// Inference endpoint name + /// + /// + /// The identifier for the Batch inference deployment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Batch inference deployment definition object. + /// + /// + /// 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 endpointName, string deploymentName, string resourceGroupName, string workspaceName, PartialBatchDeploymentPartialTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates/updates a batch inference deployment. + /// + /// + /// Inference endpoint name + /// + /// + /// The identifier for the Batch inference deployment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Batch inference deployment definition object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string endpointName, string deploymentName, string resourceGroupName, string workspaceName, BatchDeploymentTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists Batch inference deployments in the workspace. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IBatchEndpointsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IBatchEndpointsOperations.cs new file mode 100644 index 000000000000..fe43b8b988ce --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IBatchEndpointsOperations.cs @@ -0,0 +1,223 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BatchEndpointsOperations operations. + /// + public partial interface IBatchEndpointsOperations + { + /// + /// Lists Batch inference endpoint in the workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Number of endpoints to be retrieved in a page of results. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 workspaceName, int? count = default(int?), string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete Batch Inference Endpoint. + /// + /// + /// Inference Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a batch inference endpoint by name. + /// + /// + /// Name for the Batch Endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a batch inference endpoint. + /// + /// + /// Name for the Batch inference endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Mutable batch inference endpoint definition object. + /// + /// + /// 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 endpointName, string resourceGroupName, string workspaceName, PartialBatchEndpointPartialTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a batch inference endpoint. + /// + /// + /// Name for the Batch inference endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Batch inference endpoint definition object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, BatchEndpointTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists batch Inference Endpoint keys. + /// + /// + /// Inference Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> ListKeysWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists Batch inference endpoint in the workspace. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ICodeContainersOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ICodeContainersOperations.cs new file mode 100644 index 000000000000..bbef2cde4480 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ICodeContainersOperations.cs @@ -0,0 +1,161 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CodeContainersOperations operations. + /// + public partial interface ICodeContainersOperations + { + /// + /// List containers. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 workspaceName, string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string name, string resourceGroupName, string workspaceName, CodeContainerResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List containers. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ICodeVersionsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ICodeVersionsOperations.cs new file mode 100644 index 000000000000..cc9787830147 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ICodeVersionsOperations.cs @@ -0,0 +1,179 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CodeVersionsOperations operations. + /// + public partial interface ICodeVersionsOperations + { + /// + /// List versions. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Version entity to create or update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string name, string version, string resourceGroupName, string workspaceName, CodeVersionResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List versions. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IComputeOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IComputeOperations.cs new file mode 100644 index 000000000000..41e8ca4b638b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IComputeOperations.cs @@ -0,0 +1,533 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ComputeOperations operations. + /// + public partial interface IComputeOperations + { + /// + /// Gets computes in specified workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 workspaceName, string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets compute definition by its name. Any secrets (storage keys, + /// service credentials, etc) are not returned - use 'keys' nested + /// resource to get them. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// 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 workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates compute. This call will overwrite a compute if + /// it exists. This is a nonrecoverable operation. If your intent is to + /// create a new compute, do a GET first to verify that it does not + /// exist yet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Payload with Machine Learning compute definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, ComputeResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates properties of a compute. This call will overwrite a compute + /// if it exists. This is a nonrecoverable operation. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Additional parameters for cluster update. + /// + /// + /// 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 workspaceName, string computeName, ClusterUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes specified Machine Learning compute. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Delete the underlying compute if 'Delete', or detach the underlying + /// compute from workspace if 'Detach'. Possible values include: + /// 'Delete', 'Detach' + /// + /// + /// 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 workspaceName, string computeName, string underlyingResourceAction, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the details (e.g IP address, port etc) of all the compute nodes + /// in the compute. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// 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>> ListNodesWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets secrets related to Machine Learning compute (storage keys, + /// service credentials, etc). + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// 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> ListKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Posts a start action to a compute instance + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// 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 StartWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Posts a stop action to a compute instance + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// 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 StopWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Posts a restart action to a compute instance + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// 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 RestartWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates schedules of a compute instance + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// The object for updating schedules of specified ComputeInstance. + /// + /// + /// 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 UpdateSchedulesWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, ComputeSchedules parameters = default(ComputeSchedules), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates compute. This call will overwrite a compute if + /// it exists. This is a nonrecoverable operation. If your intent is to + /// create a new compute, do a GET first to verify that it does not + /// exist yet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Payload with Machine Learning compute definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, ComputeResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates properties of a compute. This call will overwrite a compute + /// if it exists. This is a nonrecoverable operation. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Additional parameters for cluster update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, ClusterUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes specified Machine Learning compute. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// Delete the underlying compute if 'Delete', or detach the underlying + /// compute from workspace if 'Detach'. Possible values include: + /// 'Delete', 'Detach' + /// + /// + /// 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 workspaceName, string computeName, string underlyingResourceAction, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Posts a start action to a compute instance + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// 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 BeginStartWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Posts a stop action to a compute instance + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the Azure Machine Learning compute. + /// + /// + /// 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 BeginStopWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string computeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets computes in specified workspace. + /// + /// + /// 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)); + /// + /// Get the details (e.g IP address, port etc) of all the compute nodes + /// in the compute. + /// + /// + /// 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>> ListNodesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IDataContainersOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IDataContainersOperations.cs new file mode 100644 index 000000000000..d299ce3cbced --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IDataContainersOperations.cs @@ -0,0 +1,161 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DataContainersOperations operations. + /// + public partial interface IDataContainersOperations + { + /// + /// List containers. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 workspaceName, string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string name, string resourceGroupName, string workspaceName, DataContainerResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List containers. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IDataVersionsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IDataVersionsOperations.cs new file mode 100644 index 000000000000..2c46e246fc10 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IDataVersionsOperations.cs @@ -0,0 +1,183 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DataVersionsOperations operations. + /// + public partial interface IDataVersionsOperations + { + /// + /// List data versions. + /// + /// + /// Data name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Comma-separated list of tag names (and optionally values). Example: + /// tag1,tag2=value2 + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), string tags = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Version entity to create or update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string name, string version, string resourceGroupName, string workspaceName, DataVersionResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List data versions. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IDatastoresOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IDatastoresOperations.cs new file mode 100644 index 000000000000..452340cb9f62 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IDatastoresOperations.cs @@ -0,0 +1,210 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatastoresOperations operations. + /// + public partial interface IDatastoresOperations + { + /// + /// List datastores. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Maximum number of results to return. + /// + /// + /// Filter down to the workspace default datastore. + /// + /// + /// Names of datastores to return. + /// + /// + /// Text to search for in the datastore names. + /// + /// + /// Order by property (createdtime | modifiedtime | name). + /// + /// + /// Order by property in ascending order. + /// + /// + /// 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 workspaceName, string skip = default(string), int? count = 30, bool? isDefault = default(bool?), IList names = default(IList), string searchText = default(string), string orderBy = default(string), bool? orderByAsc = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete datastore. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get datastore. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update datastore. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Datastore entity to create or update. + /// + /// + /// Flag to skip validation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string name, string resourceGroupName, string workspaceName, DatastorePropertiesResource body, bool? skipValidation = false, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get datastore secrets. + /// + /// + /// Datastore name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> ListSecretsWithHttpMessagesAsync(string name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List datastores. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IEnvironmentContainersOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IEnvironmentContainersOperations.cs new file mode 100644 index 000000000000..9bb6f2465509 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IEnvironmentContainersOperations.cs @@ -0,0 +1,161 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EnvironmentContainersOperations operations. + /// + public partial interface IEnvironmentContainersOperations + { + /// + /// List containers. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 workspaceName, string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string name, string resourceGroupName, string workspaceName, EnvironmentContainerResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List containers. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IEnvironmentSpecificationVersionsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IEnvironmentSpecificationVersionsOperations.cs new file mode 100644 index 000000000000..c37eeb99f072 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IEnvironmentSpecificationVersionsOperations.cs @@ -0,0 +1,179 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EnvironmentSpecificationVersionsOperations operations. + /// + public partial interface IEnvironmentSpecificationVersionsOperations + { + /// + /// List versions. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an EnvironmentSpecificationVersion. + /// + /// + /// Name of EnvironmentSpecificationVersion. + /// + /// + /// Version of EnvironmentSpecificationVersion. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Definition of EnvironmentSpecificationVersion. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string name, string version, string resourceGroupName, string workspaceName, EnvironmentSpecificationVersionResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List versions. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IJobsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IJobsOperations.cs new file mode 100644 index 000000000000..d61e0dfae661 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IJobsOperations.cs @@ -0,0 +1,220 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// JobsOperations operations. + /// + public partial interface IJobsOperations + { + /// + /// Lists Jobs in the workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Type of job to be returned. + /// + /// + /// Tags for job to be returned. + /// + /// + /// Jobs returned will have this tag key. + /// + /// + /// 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 workspaceName, string skip = default(string), string jobType = default(string), string tags = default(string), string tag = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Job (asynchronous). + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a Job by name/id. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates and executes a Job. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Job definition object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, JobBaseResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Cancels a Job. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 CancelWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Job (asynchronous). + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists Jobs in the workspace. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ILabelingJobsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ILabelingJobsOperations.cs new file mode 100644 index 000000000000..10830a4e7ee5 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ILabelingJobsOperations.cs @@ -0,0 +1,340 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// LabelingJobsOperations operations. + /// + public partial interface ILabelingJobsOperations + { + /// + /// Lists labeling jobs in the workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Number of labeling jobs to return. + /// + /// + /// 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 workspaceName, string skip = default(string), int? count = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a labeling job. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a labeling job by name/id. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Boolean value to indicate whether to include JobInstructions in + /// response. + /// + /// + /// Boolean value to indicate Whether to include LabelCategories in + /// response. + /// + /// + /// 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 id, string resourceGroupName, string workspaceName, bool? includeJobInstructions = default(bool?), bool? includeLabelCategories = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a labeling job (asynchronous). + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// LabelingJob definition object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, LabelingJobResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Export labels from a labeling job (asynchronous). + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The export summary. + /// + /// + /// 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> ExportLabelsWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, ExportSummary body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Pause a labeling job. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 PauseWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Resume a labeling job (asynchronous). + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> ResumeWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a labeling job (asynchronous). + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// LabelingJob definition object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, LabelingJobResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Export labels from a labeling job (asynchronous). + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The export summary. + /// + /// + /// 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> BeginExportLabelsWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, ExportSummary body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Resume a labeling job (asynchronous). + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> BeginResumeWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists labeling jobs in the workspace. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IModelContainersOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IModelContainersOperations.cs new file mode 100644 index 000000000000..886c719befb5 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IModelContainersOperations.cs @@ -0,0 +1,164 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ModelContainersOperations operations. + /// + public partial interface IModelContainersOperations + { + /// + /// List model containers. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Maximum number of results to return. + /// + /// + /// 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 workspaceName, string skip = default(string), int? count = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string name, string resourceGroupName, string workspaceName, ModelContainerResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List model containers. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IModelVersionsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IModelVersionsOperations.cs new file mode 100644 index 000000000000..1d9274917279 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IModelVersionsOperations.cs @@ -0,0 +1,196 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ModelVersionsOperations operations. + /// + public partial interface IModelVersionsOperations + { + /// + /// List model versions. + /// + /// + /// Model name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Model version. + /// + /// + /// Model description. + /// + /// + /// Number of initial results to skip. + /// + /// + /// Comma-separated list of tag names (and optionally values). Example: + /// tag1,tag2=value2 + /// + /// + /// Comma-separated list of property names (and optionally values). + /// Example: prop1,prop2=value2 + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, string skip = default(string), string orderBy = default(string), int? top = default(int?), string version = default(string), string description = default(string), int? offset = default(int?), string tags = default(string), string properties = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Version entity to create or update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string name, string version, string resourceGroupName, string workspaceName, ModelVersionResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List model versions. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IOnlineDeploymentsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IOnlineDeploymentsOperations.cs new file mode 100644 index 000000000000..a4c4f66fc549 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IOnlineDeploymentsOperations.cs @@ -0,0 +1,343 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OnlineDeploymentsOperations operations. + /// + public partial interface IOnlineDeploymentsOperations + { + /// + /// List Inference Endpoint Deployments. + /// + /// + /// Inference endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Top of list. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 endpointName, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete Inference Endpoint Deployment (asynchronous). + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string deploymentName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get Inference Deployment Deployment. + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string deploymentName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update Online Deployment (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during 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> UpdateWithHttpMessagesAsync(string endpointName, string deploymentName, string resourceGroupName, string workspaceName, PartialOnlineDeploymentPartialTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update Inference Endpoint Deployment (asynchronous). + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Inference Endpoint entity to apply during 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> CreateOrUpdateWithHttpMessagesAsync(string endpointName, string deploymentName, string resourceGroupName, string workspaceName, OnlineDeploymentTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Polls an Endpoint operation. + /// + /// + /// Inference endpoint name. + /// + /// + /// The name and identifier for the endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The request containing parameters for retrieving logs. + /// + /// + /// 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> GetLogsWithHttpMessagesAsync(string endpointName, string deploymentName, string resourceGroupName, string workspaceName, DeploymentLogsRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete Inference Endpoint Deployment (asynchronous). + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string deploymentName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update Online Deployment (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during 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> BeginUpdateWithHttpMessagesAsync(string endpointName, string deploymentName, string resourceGroupName, string workspaceName, PartialOnlineDeploymentPartialTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update Inference Endpoint Deployment (asynchronous). + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Inference Endpoint entity to apply during 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> BeginCreateOrUpdateWithHttpMessagesAsync(string endpointName, string deploymentName, string resourceGroupName, string workspaceName, OnlineDeploymentTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List Inference Endpoint Deployments. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IOnlineEndpointsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IOnlineEndpointsOperations.cs new file mode 100644 index 000000000000..d5dd126efc6b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IOnlineEndpointsOperations.cs @@ -0,0 +1,419 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OnlineEndpointsOperations operations. + /// + public partial interface IOnlineEndpointsOperations + { + /// + /// List Online Endpoints. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the endpoint. + /// + /// + /// Number of endpoints to be retrieved in a page of results. + /// + /// + /// EndpointComputeType to be filtered by. Possible values include: + /// 'Managed', 'K8S', 'AzureMLCompute' + /// + /// + /// Continuation token for pagination. + /// + /// + /// A set of tags with which to filter the returned models. It is a + /// comma separated string of tags key or tags key=value. Example: + /// tagKey1,tagKey2,tagKey3=value3 . + /// + /// + /// A set of properties with which to filter the returned models. It is + /// a comma separated string of properties key and/or properties + /// key=value Example: propKey1,propKey2,propKey3=value3 . + /// + /// + /// The option to order the response. Possible values include: + /// 'CreatedAtDesc', 'CreatedAtAsc', 'UpdatedAtDesc', 'UpdatedAtAsc' + /// + /// + /// 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 workspaceName, string name = default(string), int? count = default(int?), string computeType = default(string), string skip = default(string), string tags = default(string), string properties = default(string), string orderBy = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete Online Endpoint (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get Online Endpoint. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update Online Endpoint (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during 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> UpdateWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, PartialOnlineEndpointPartialTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update Online Endpoint (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during 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> CreateOrUpdateWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, OnlineEndpointTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List EndpointAuthKeys for an Endpoint using Key-based + /// authentication. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> ListKeysWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Regenerate EndpointAuthKeys for an Endpoint using Key-based + /// authentication (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// RegenerateKeys request . + /// + /// + /// 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> RegenerateKeysWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, RegenerateEndpointKeysRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve a valid AAD token for an Endpoint using AMLToken-based + /// authentication. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> GetTokenWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete Online Endpoint (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update Online Endpoint (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during 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> BeginUpdateWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, PartialOnlineEndpointPartialTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update Online Endpoint (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during 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> BeginCreateOrUpdateWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, OnlineEndpointTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Regenerate EndpointAuthKeys for an Endpoint using Key-based + /// authentication (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// RegenerateKeys request . + /// + /// + /// 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> BeginRegenerateKeysWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, RegenerateEndpointKeysRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List Online Endpoints. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IOperations.cs new file mode 100644 index 000000000000..732ec4476da5 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IOperations.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.Azure.Management.MachineLearningServices +{ + 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 of the available Azure Machine Learning Workspaces REST + /// API operations. + /// + /// + /// 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)); + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IPrivateEndpointConnectionsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IPrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..4788cafe2e6f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IPrivateEndpointConnectionsOperations.cs @@ -0,0 +1,143 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateEndpointConnectionsOperations operations. + /// + public partial interface IPrivateEndpointConnectionsOperations + { + /// + /// List all the private endpoint connections associated with the + /// workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the specified private endpoint connection associated with the + /// workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The name of the private endpoint connection associated with the + /// workspace + /// + /// + /// 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 workspaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the state of specified private endpoint connection + /// associated with the workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The name of the private endpoint connection associated with the + /// workspace + /// + /// + /// The private endpoint connection 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified private endpoint connection associated with + /// the workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The name of the private endpoint connection associated with the + /// workspace + /// + /// + /// 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 workspaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IPrivateLinkResourcesOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IPrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..e680ad2f74c5 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IPrivateLinkResourcesOperations.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.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateLinkResourcesOperations operations. + /// + public partial interface IPrivateLinkResourcesOperations + { + /// + /// Gets the private link resources that need to be created for a + /// workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IQuotasOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IQuotasOperations.cs new file mode 100644 index 000000000000..31aad2fdfe5a --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IQuotasOperations.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// QuotasOperations operations. + /// + public partial interface IQuotasOperations + { + /// + /// Update quota for each VM family in workspace. + /// + /// + /// The location for update quota is queried. + /// + /// + /// Quota update parameters. + /// + /// + /// 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 location, QuotaUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the currently assigned Workspace Quotas based on VMFamily. + /// + /// + /// The location for which resource usage is queried. + /// + /// + /// 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 location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the currently assigned Workspace Quotas based on VMFamily. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IUsagesOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IUsagesOperations.cs new file mode 100644 index 000000000000..6864e81d92e6 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IUsagesOperations.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// UsagesOperations operations. + /// + public partial interface IUsagesOperations + { + /// + /// Gets the current usage information as well as limits for AML + /// resources for given subscription and location. + /// + /// + /// The location for which resource usage is queried. + /// + /// + /// 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 location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the current usage information as well as limits for AML + /// resources for given subscription and location. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IVirtualMachineSizesOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IVirtualMachineSizesOperations.cs new file mode 100644 index 000000000000..08c5562882ff --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IVirtualMachineSizesOperations.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.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualMachineSizesOperations operations. + /// + public partial interface IVirtualMachineSizesOperations + { + /// + /// Returns supported VM Sizes in a location + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// 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 location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IWorkspaceConnectionsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IWorkspaceConnectionsOperations.cs new file mode 100644 index 000000000000..53d8f2690818 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IWorkspaceConnectionsOperations.cs @@ -0,0 +1,142 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkspaceConnectionsOperations operations. + /// + public partial interface IWorkspaceConnectionsOperations + { + /// + /// List all connections under a AML workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Target of the workspace connection. + /// + /// + /// Category of the workspace connection. + /// + /// + /// 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 workspaceName, string target = default(string), string category = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Add a new workspace connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Friendly name of the workspace connection + /// + /// + /// The object for creating or updating a new workspace connection + /// + /// + /// 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 workspaceName, string connectionName, WorkspaceConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the detail of a workspace connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Friendly name of the workspace connection + /// + /// + /// 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 workspaceName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a workspace connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Friendly name of the workspace connection + /// + /// + /// 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 workspaceName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IWorkspaceFeaturesOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IWorkspaceFeaturesOperations.cs new file mode 100644 index 000000000000..8fe264b2d19b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IWorkspaceFeaturesOperations.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkspaceFeaturesOperations operations. + /// + public partial interface IWorkspaceFeaturesOperations + { + /// + /// Lists all enabled features for a workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all enabled features for a workspace + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IWorkspaceSkusOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IWorkspaceSkusOperations.cs new file mode 100644 index 000000000000..d08466e3ae61 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IWorkspaceSkusOperations.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.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkspaceSkusOperations operations. + /// + public partial interface IWorkspaceSkusOperations + { + /// + /// Lists all skus with associated features + /// + /// + /// 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 skus with associated features + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IWorkspacesOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IWorkspacesOperations.cs new file mode 100644 index 000000000000..26d67208dc57 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/IWorkspacesOperations.cs @@ -0,0 +1,465 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkspacesOperations operations. + /// + public partial interface IWorkspacesOperations + { + /// + /// Gets the properties of the specified machine learning workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a workspace with the specified parameters. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The parameters for creating or updating a machine learning + /// workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a machine learning workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a machine learning workspace with the specified parameters. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The parameters for updating a machine learning workspace. + /// + /// + /// 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 workspaceName, WorkspaceUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the available machine learning workspaces under the + /// specified resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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, string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the keys associated with this workspace. This includes + /// keys for the storage account, app insights and password for + /// container registry + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> ListKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Resync all the keys associated with this workspace. This includes + /// keys for the storage account, app insights and password for + /// container registry + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 ResyncKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the available machine learning workspaces under the + /// specified subscription. + /// + /// + /// Continuation token for pagination. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// return notebook access token and refresh token + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> ListNotebookAccessTokenWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> PrepareNotebookWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> ListStorageAccountKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> ListNotebookKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a workspace with the specified parameters. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The parameters for creating or updating a machine learning + /// workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a machine learning workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Resync all the keys associated with this workspace. This includes + /// keys for the storage account, app insights and password for + /// container registry + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 BeginResyncKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> BeginPrepareNotebookWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the available machine learning workspaces under 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)); + /// + /// Lists all the available machine learning workspaces under the + /// specified subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/JobsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/JobsOperations.cs new file mode 100644 index 000000000000..12a71b555157 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/JobsOperations.cs @@ -0,0 +1,1409 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// JobsOperations operations. + /// + internal partial class JobsOperations : IServiceOperations, IJobsOperations + { + /// + /// Initializes a new instance of the JobsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal JobsOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// Lists Jobs in the workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Type of job to be returned. + /// + /// + /// Tags for job to be returned. + /// + /// + /// Jobs returned will have this tag key. + /// + /// + /// 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 workspaceName, string skip = default(string), string jobType = default(string), string tags = default(string), string tag = default(string), 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("skip", skip); + tracingParameters.Add("jobType", jobType); + tracingParameters.Add("tags", tags); + tracingParameters.Add("tag", tag); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/jobs").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + if (jobType != null) + { + _queryParameters.Add(string.Format("jobType={0}", System.Uri.EscapeDataString(jobType))); + } + if (tags != null) + { + _queryParameters.Add(string.Format("tags={0}", System.Uri.EscapeDataString(tags))); + } + if (tag != null) + { + _queryParameters.Add(string.Format("tag={0}", System.Uri.EscapeDataString(tag))); + } + 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; + } + + /// + /// Deletes a Job (asynchronous). + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(id, resourceGroupName, workspaceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Job by name/id. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("id", id); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 and executes a Job. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Job definition object. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, JobBaseResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (id != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(id, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "id", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("id", id); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Cancels a Job. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 CancelWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("id", id); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Cancel", 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.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}/cancel").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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; + } + + /// + /// Deletes a Job (asynchronous). + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("id", id); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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; + } + + /// + /// Lists Jobs in the workspace. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/JobsOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/JobsOperationsExtensions.cs new file mode 100644 index 000000000000..3e1f7ba72ac9 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/JobsOperationsExtensions.cs @@ -0,0 +1,356 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for JobsOperations. + /// + public static partial class JobsOperationsExtensions + { + /// + /// Lists Jobs in the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Type of job to be returned. + /// + /// + /// Tags for job to be returned. + /// + /// + /// Jobs returned will have this tag key. + /// + public static IPage List(this IJobsOperations operations, string resourceGroupName, string workspaceName, string skip = default(string), string jobType = default(string), string tags = default(string), string tag = default(string)) + { + return operations.ListAsync(resourceGroupName, workspaceName, skip, jobType, tags, tag).GetAwaiter().GetResult(); + } + + /// + /// Lists Jobs in the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Type of job to be returned. + /// + /// + /// Tags for job to be returned. + /// + /// + /// Jobs returned will have this tag key. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IJobsOperations operations, string resourceGroupName, string workspaceName, string skip = default(string), string jobType = default(string), string tags = default(string), string tag = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, skip, jobType, tags, tag, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static JobsDeleteHeaders Delete(this IJobsOperations operations, string id, string resourceGroupName, string workspaceName) + { + return operations.DeleteAsync(id, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IJobsOperations operations, string id, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(id, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Gets a Job by name/id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static JobBaseResource Get(this IJobsOperations operations, string id, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(id, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a Job by name/id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IJobsOperations operations, string id, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(id, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates and executes a Job. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Job definition object. + /// + public static JobBaseResource CreateOrUpdate(this IJobsOperations operations, string id, string resourceGroupName, string workspaceName, JobBaseResource body) + { + return operations.CreateOrUpdateAsync(id, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Creates and executes a Job. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Job definition object. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IJobsOperations operations, string id, string resourceGroupName, string workspaceName, JobBaseResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(id, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Cancels a Job. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void Cancel(this IJobsOperations operations, string id, string resourceGroupName, string workspaceName) + { + operations.CancelAsync(id, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Cancels a Job. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task CancelAsync(this IJobsOperations operations, string id, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.CancelWithHttpMessagesAsync(id, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes a Job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static JobsDeleteHeaders BeginDelete(this IJobsOperations operations, string id, string resourceGroupName, string workspaceName) + { + return operations.BeginDeleteAsync(id, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the Job. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IJobsOperations operations, string id, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(id, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Lists Jobs in the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IJobsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists Jobs in the workspace. + /// + /// + /// 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 IJobsOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/LabelingJobsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/LabelingJobsOperations.cs new file mode 100644 index 000000000000..64e4040f971f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/LabelingJobsOperations.cs @@ -0,0 +1,1934 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// LabelingJobsOperations operations. + /// + internal partial class LabelingJobsOperations : IServiceOperations, ILabelingJobsOperations + { + /// + /// Initializes a new instance of the LabelingJobsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal LabelingJobsOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// Lists labeling jobs in the workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Number of labeling jobs to return. + /// + /// + /// 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 workspaceName, string skip = default(string), int? count = default(int?), 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("skip", skip); + tracingParameters.Add("count", count); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/labelingJobs").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + if (count != null) + { + _queryParameters.Add(string.Format("count={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(count, Client.SerializationSettings).Trim('"')))); + } + 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; + } + + /// + /// Delete a labeling job. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("id", id); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Gets a labeling job by name/id. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Boolean value to indicate whether to include JobInstructions in response. + /// + /// + /// Boolean value to indicate Whether to include LabelCategories in response. + /// + /// + /// 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 id, string resourceGroupName, string workspaceName, bool? includeJobInstructions = default(bool?), bool? includeLabelCategories = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("id", id); + tracingParameters.Add("includeJobInstructions", includeJobInstructions); + tracingParameters.Add("includeLabelCategories", includeLabelCategories); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (includeJobInstructions != null) + { + _queryParameters.Add(string.Format("includeJobInstructions={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeJobInstructions, Client.SerializationSettings).Trim('"')))); + } + if (includeLabelCategories != null) + { + _queryParameters.Add(string.Format("includeLabelCategories={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeLabelCategories, Client.SerializationSettings).Trim('"')))); + } + 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 or updates a labeling job (asynchronous). + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// LabelingJob definition object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, LabelingJobResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(id, resourceGroupName, workspaceName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Export labels from a labeling job (asynchronous). + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The export summary. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ExportLabelsWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, ExportSummary body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginExportLabelsWithHttpMessagesAsync(id, resourceGroupName, workspaceName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Pause a labeling job. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 PauseWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("id", id); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Pause", 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.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/pause").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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; + } + + /// + /// Resume a labeling job (asynchronous). + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ResumeWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginResumeWithHttpMessagesAsync(id, resourceGroupName, workspaceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a labeling job (asynchronous). + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// LabelingJob definition object. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, LabelingJobResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (id != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(id, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "id", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("id", id); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + 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; + } + + /// + /// Export labels from a labeling job (asynchronous). + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The export summary. + /// + /// + /// 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> BeginExportLabelsWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, ExportSummary body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + 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("id", id); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginExportLabels", 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.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/exportLabels").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + 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; + } + + /// + /// Resume a labeling job (asynchronous). + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> BeginResumeWithHttpMessagesAsync(string id, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("id", id); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginResume", 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.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/resume").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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; + } + + /// + /// Lists labeling jobs in the workspace. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/LabelingJobsOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/LabelingJobsOperationsExtensions.cs new file mode 100644 index 000000000000..4b1ff841a61a --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/LabelingJobsOperationsExtensions.cs @@ -0,0 +1,555 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for LabelingJobsOperations. + /// + public static partial class LabelingJobsOperationsExtensions + { + /// + /// Lists labeling jobs in the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Number of labeling jobs to return. + /// + public static IPage List(this ILabelingJobsOperations operations, string resourceGroupName, string workspaceName, string skip = default(string), int? count = default(int?)) + { + return operations.ListAsync(resourceGroupName, workspaceName, skip, count).GetAwaiter().GetResult(); + } + + /// + /// Lists labeling jobs in the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Number of labeling jobs to return. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ILabelingJobsOperations operations, string resourceGroupName, string workspaceName, string skip = default(string), int? count = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, skip, count, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a labeling job. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void Delete(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName) + { + operations.DeleteAsync(id, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete a labeling job. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(id, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a labeling job by name/id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Boolean value to indicate whether to include JobInstructions in response. + /// + /// + /// Boolean value to indicate Whether to include LabelCategories in response. + /// + public static LabelingJobResource Get(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName, bool? includeJobInstructions = default(bool?), bool? includeLabelCategories = default(bool?)) + { + return operations.GetAsync(id, resourceGroupName, workspaceName, includeJobInstructions, includeLabelCategories).GetAwaiter().GetResult(); + } + + /// + /// Gets a labeling job by name/id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Boolean value to indicate whether to include JobInstructions in response. + /// + /// + /// Boolean value to indicate Whether to include LabelCategories in response. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName, bool? includeJobInstructions = default(bool?), bool? includeLabelCategories = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(id, resourceGroupName, workspaceName, includeJobInstructions, includeLabelCategories, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a labeling job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// LabelingJob definition object. + /// + public static LabelingJobResource CreateOrUpdate(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName, LabelingJobResource body) + { + return operations.CreateOrUpdateAsync(id, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a labeling job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// LabelingJob definition object. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName, LabelingJobResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(id, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Export labels from a labeling job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The export summary. + /// + public static ExportSummary ExportLabels(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName, ExportSummary body) + { + return operations.ExportLabelsAsync(id, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Export labels from a labeling job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The export summary. + /// + /// + /// The cancellation token. + /// + public static async Task ExportLabelsAsync(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName, ExportSummary body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExportLabelsWithHttpMessagesAsync(id, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Pause a labeling job. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void Pause(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName) + { + operations.PauseAsync(id, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Pause a labeling job. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task PauseAsync(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PauseWithHttpMessagesAsync(id, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Resume a labeling job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static LabelingJobsResumeHeaders Resume(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName) + { + return operations.ResumeAsync(id, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Resume a labeling job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task ResumeAsync(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ResumeWithHttpMessagesAsync(id, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Creates or updates a labeling job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// LabelingJob definition object. + /// + public static LabelingJobResource BeginCreateOrUpdate(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName, LabelingJobResource body) + { + return operations.BeginCreateOrUpdateAsync(id, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a labeling job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// LabelingJob definition object. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName, LabelingJobResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(id, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Export labels from a labeling job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The export summary. + /// + public static ExportSummary BeginExportLabels(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName, ExportSummary body) + { + return operations.BeginExportLabelsAsync(id, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Export labels from a labeling job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The export summary. + /// + /// + /// The cancellation token. + /// + public static async Task BeginExportLabelsAsync(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName, ExportSummary body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginExportLabelsWithHttpMessagesAsync(id, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Resume a labeling job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static LabelingJobsResumeHeaders BeginResume(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName) + { + return operations.BeginResumeAsync(id, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Resume a labeling job (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name and identifier for the LabelingJob. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task BeginResumeAsync(this ILabelingJobsOperations operations, string id, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginResumeWithHttpMessagesAsync(id, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Lists labeling jobs in the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ILabelingJobsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists labeling jobs in the workspace. + /// + /// + /// 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 ILabelingJobsOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ModelContainersOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ModelContainersOperations.cs new file mode 100644 index 000000000000..fe493beb6e3f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ModelContainersOperations.cs @@ -0,0 +1,1151 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// ModelContainersOperations operations. + /// + internal partial class ModelContainersOperations : IServiceOperations, IModelContainersOperations + { + /// + /// Initializes a new instance of the ModelContainersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ModelContainersOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// List model containers. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Maximum number of results to return. + /// + /// + /// 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 workspaceName, string skip = default(string), int? count = default(int?), 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("skip", skip); + tracingParameters.Add("count", count); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/models").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + if (count != null) + { + _queryParameters.Add(string.Format("count={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(count, Client.SerializationSettings).Trim('"')))); + } + 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; + } + + /// + /// Delete container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/models/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Get container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/models/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update container. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string name, string resourceGroupName, string workspaceName, ModelContainerResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (name != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(name, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "name", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.MachineLearningServices/workspaces/{workspaceName}/models/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List model containers. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ModelContainersOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ModelContainersOperationsExtensions.cs new file mode 100644 index 000000000000..a37ae9b3b7a1 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ModelContainersOperationsExtensions.cs @@ -0,0 +1,252 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ModelContainersOperations. + /// + public static partial class ModelContainersOperationsExtensions + { + /// + /// List model containers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Maximum number of results to return. + /// + public static IPage List(this IModelContainersOperations operations, string resourceGroupName, string workspaceName, string skip = default(string), int? count = default(int?)) + { + return operations.ListAsync(resourceGroupName, workspaceName, skip, count).GetAwaiter().GetResult(); + } + + /// + /// List model containers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Maximum number of results to return. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IModelContainersOperations operations, string resourceGroupName, string workspaceName, string skip = default(string), int? count = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, skip, count, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void Delete(this IModelContainersOperations operations, string name, string resourceGroupName, string workspaceName) + { + operations.DeleteAsync(name, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IModelContainersOperations operations, string name, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(name, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static ModelContainerResource Get(this IModelContainersOperations operations, string name, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(name, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Get container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IModelContainersOperations operations, string name, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + public static ModelContainerResource CreateOrUpdate(this IModelContainersOperations operations, string name, string resourceGroupName, string workspaceName, ModelContainerResource body) + { + return operations.CreateOrUpdateAsync(name, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update container. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Container entity to create or update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IModelContainersOperations operations, string name, string resourceGroupName, string workspaceName, ModelContainerResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List model containers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IModelContainersOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List model containers. + /// + /// + /// 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 IModelContainersOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ModelVersionsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ModelVersionsOperations.cs new file mode 100644 index 000000000000..8177f955ea02 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ModelVersionsOperations.cs @@ -0,0 +1,1237 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// ModelVersionsOperations operations. + /// + internal partial class ModelVersionsOperations : IServiceOperations, IModelVersionsOperations + { + /// + /// Initializes a new instance of the ModelVersionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ModelVersionsOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// List model versions. + /// + /// + /// Model name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Model version. + /// + /// + /// Model description. + /// + /// + /// Number of initial results to skip. + /// + /// + /// Comma-separated list of tag names (and optionally values). Example: + /// tag1,tag2=value2 + /// + /// + /// Comma-separated list of property names (and optionally values). Example: + /// prop1,prop2=value2 + /// + /// + /// 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 name, string resourceGroupName, string workspaceName, string skip = default(string), string orderBy = default(string), int? top = default(int?), string version = default(string), string description = default(string), int? offset = default(int?), string tags = default(string), string properties = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("skip", skip); + tracingParameters.Add("orderBy", orderBy); + tracingParameters.Add("top", top); + tracingParameters.Add("version", version); + tracingParameters.Add("description", description); + tracingParameters.Add("offset", offset); + tracingParameters.Add("tags", tags); + tracingParameters.Add("properties", properties); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + if (orderBy != null) + { + _queryParameters.Add(string.Format("$orderBy={0}", System.Uri.EscapeDataString(orderBy))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (version != null) + { + _queryParameters.Add(string.Format("version={0}", System.Uri.EscapeDataString(version))); + } + if (description != null) + { + _queryParameters.Add(string.Format("description={0}", System.Uri.EscapeDataString(description))); + } + if (offset != null) + { + _queryParameters.Add(string.Format("offset={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(offset, Client.SerializationSettings).Trim('"')))); + } + if (tags != null) + { + _queryParameters.Add(string.Format("tags={0}", System.Uri.EscapeDataString(tags))); + } + if (properties != null) + { + _queryParameters.Add(string.Format("properties={0}", System.Uri.EscapeDataString(properties))); + } + 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; + } + + /// + /// Delete version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("version", version); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Get version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 name, string version, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("version", version); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update version. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Version entity to create or update. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string name, string version, string resourceGroupName, string workspaceName, ModelVersionResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (name != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(name, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "name", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("version", version); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List model versions. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ModelVersionsOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ModelVersionsOperationsExtensions.cs new file mode 100644 index 000000000000..a5f6a495d77c --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/ModelVersionsOperationsExtensions.cs @@ -0,0 +1,316 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ModelVersionsOperations. + /// + public static partial class ModelVersionsOperationsExtensions + { + /// + /// List model versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Model name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Model version. + /// + /// + /// Model description. + /// + /// + /// Number of initial results to skip. + /// + /// + /// Comma-separated list of tag names (and optionally values). Example: + /// tag1,tag2=value2 + /// + /// + /// Comma-separated list of property names (and optionally values). Example: + /// prop1,prop2=value2 + /// + public static IPage List(this IModelVersionsOperations operations, string name, string resourceGroupName, string workspaceName, string skip = default(string), string orderBy = default(string), int? top = default(int?), string version = default(string), string description = default(string), int? offset = default(int?), string tags = default(string), string properties = default(string)) + { + return operations.ListAsync(name, resourceGroupName, workspaceName, skip, orderBy, top, version, description, offset, tags, properties).GetAwaiter().GetResult(); + } + + /// + /// List model versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Model name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Ordering of list. + /// + /// + /// Maximum number of records to return. + /// + /// + /// Model version. + /// + /// + /// Model description. + /// + /// + /// Number of initial results to skip. + /// + /// + /// Comma-separated list of tag names (and optionally values). Example: + /// tag1,tag2=value2 + /// + /// + /// Comma-separated list of property names (and optionally values). Example: + /// prop1,prop2=value2 + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IModelVersionsOperations operations, string name, string resourceGroupName, string workspaceName, string skip = default(string), string orderBy = default(string), int? top = default(int?), string version = default(string), string description = default(string), int? offset = default(int?), string tags = default(string), string properties = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(name, resourceGroupName, workspaceName, skip, orderBy, top, version, description, offset, tags, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void Delete(this IModelVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName) + { + operations.DeleteAsync(name, version, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IModelVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(name, version, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static ModelVersionResource Get(this IModelVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(name, version, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Get version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IModelVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, version, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Version entity to create or update. + /// + public static ModelVersionResource CreateOrUpdate(this IModelVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, ModelVersionResource body) + { + return operations.CreateOrUpdateAsync(name, version, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update version. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Container name. + /// + /// + /// Version identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Version entity to create or update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IModelVersionsOperations operations, string name, string version, string resourceGroupName, string workspaceName, ModelVersionResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(name, version, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List model versions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IModelVersionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List model versions. + /// + /// + /// 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 IModelVersionsOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AKS.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AKS.cs new file mode 100644 index 000000000000..28408bfc6662 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AKS.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A Machine Learning compute based on AKS. + /// + public partial class AKS : Compute + { + /// + /// Initializes a new instance of the AKS class. + /// + public AKS() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AKS class. + /// + /// Location for the underlying + /// compute + /// The provision state of the cluster. + /// Valid values are Unknown, Updating, Provisioning, Succeeded, and + /// Failed. Possible values include: 'Unknown', 'Updating', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// The description of the Machine Learning + /// compute. + /// The time at which the compute was + /// created. + /// The time at which the compute was last + /// modified. + /// ARM resource id of the underlying + /// compute + /// Errors during provisioning + /// Indicating whether the compute was + /// provisioned by user and brought from outside if true, or machine + /// learning service provisioned it if false. + /// Opt-out of local authentication and + /// ensure customers can use only MSI and AAD exclusively for + /// authentication. + /// AKS properties + public AKS(string computeLocation = default(string), string provisioningState = default(string), string description = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? modifiedOn = default(System.DateTime?), string resourceId = default(string), IList provisioningErrors = default(IList), bool? isAttachedCompute = default(bool?), bool? disableLocalAuth = default(bool?), AKSProperties properties = default(AKSProperties)) + : base(computeLocation, provisioningState, description, createdOn, modifiedOn, resourceId, provisioningErrors, isAttachedCompute, disableLocalAuth) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets AKS properties + /// + [JsonProperty(PropertyName = "properties")] + public AKSProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AKSProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AKSProperties.cs new file mode 100644 index 000000000000..0e04106f2bcb --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AKSProperties.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// AKS properties + /// + public partial class AKSProperties + { + /// + /// Initializes a new instance of the AKSProperties class. + /// + public AKSProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AKSProperties class. + /// + /// Cluster full qualified domain + /// name + /// System services + /// Number of agents + /// Agent virtual machine size + /// Intended usage of the cluster. + /// Possible values include: 'FastProd', 'DenseProd', 'DevTest' + /// SSL configuration + /// AKS networking + /// configuration for vnet + /// Load Balancer Type. Possible values + /// include: 'PublicIp', 'InternalLoadBalancer' + /// Load Balancer Subnet + public AKSProperties(string clusterFqdn = default(string), IList systemServices = default(IList), int? agentCount = default(int?), string agentVmSize = default(string), string clusterPurpose = default(string), SslConfiguration sslConfiguration = default(SslConfiguration), AksNetworkingConfiguration aksNetworkingConfiguration = default(AksNetworkingConfiguration), string loadBalancerType = default(string), string loadBalancerSubnet = default(string)) + { + ClusterFqdn = clusterFqdn; + SystemServices = systemServices; + AgentCount = agentCount; + AgentVmSize = agentVmSize; + ClusterPurpose = clusterPurpose; + SslConfiguration = sslConfiguration; + AksNetworkingConfiguration = aksNetworkingConfiguration; + LoadBalancerType = loadBalancerType; + LoadBalancerSubnet = loadBalancerSubnet; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets cluster full qualified domain name + /// + [JsonProperty(PropertyName = "clusterFqdn")] + public string ClusterFqdn { get; set; } + + /// + /// Gets system services + /// + [JsonProperty(PropertyName = "systemServices")] + public IList SystemServices { get; private set; } + + /// + /// Gets or sets number of agents + /// + [JsonProperty(PropertyName = "agentCount")] + public int? AgentCount { get; set; } + + /// + /// Gets or sets agent virtual machine size + /// + [JsonProperty(PropertyName = "agentVmSize")] + public string AgentVmSize { get; set; } + + /// + /// Gets or sets intended usage of the cluster. Possible values + /// include: 'FastProd', 'DenseProd', 'DevTest' + /// + [JsonProperty(PropertyName = "clusterPurpose")] + public string ClusterPurpose { get; set; } + + /// + /// Gets or sets SSL configuration + /// + [JsonProperty(PropertyName = "sslConfiguration")] + public SslConfiguration SslConfiguration { get; set; } + + /// + /// Gets or sets AKS networking configuration for vnet + /// + [JsonProperty(PropertyName = "aksNetworkingConfiguration")] + public AksNetworkingConfiguration AksNetworkingConfiguration { get; set; } + + /// + /// Gets or sets load Balancer Type. Possible values include: + /// 'PublicIp', 'InternalLoadBalancer' + /// + [JsonProperty(PropertyName = "loadBalancerType")] + public string LoadBalancerType { get; set; } + + /// + /// Gets or sets load Balancer Subnet + /// + [JsonProperty(PropertyName = "loadBalancerSubnet")] + public string LoadBalancerSubnet { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AgentCount < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "AgentCount", 0); + } + if (AksNetworkingConfiguration != null) + { + AksNetworkingConfiguration.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AccountKeyDatastoreCredentials.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AccountKeyDatastoreCredentials.cs new file mode 100644 index 000000000000..b496bf4f54c8 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AccountKeyDatastoreCredentials.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Account key datastore credentials configuration. + /// + [Newtonsoft.Json.JsonObject("AccountKey")] + public partial class AccountKeyDatastoreCredentials : DatastoreCredentials + { + /// + /// Initializes a new instance of the AccountKeyDatastoreCredentials + /// class. + /// + public AccountKeyDatastoreCredentials() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccountKeyDatastoreCredentials + /// class. + /// + /// Storage account secrets. + public AccountKeyDatastoreCredentials(AccountKeyDatastoreSecrets secrets = default(AccountKeyDatastoreSecrets)) + { + Secrets = secrets; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets storage account secrets. + /// + [JsonProperty(PropertyName = "secrets")] + public AccountKeyDatastoreSecrets Secrets { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AccountKeyDatastoreSecrets.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AccountKeyDatastoreSecrets.cs new file mode 100644 index 000000000000..89701448ddbc --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AccountKeyDatastoreSecrets.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Datastore account key secrets. + /// + [Newtonsoft.Json.JsonObject("AccountKey")] + public partial class AccountKeyDatastoreSecrets : DatastoreSecrets + { + /// + /// Initializes a new instance of the AccountKeyDatastoreSecrets class. + /// + public AccountKeyDatastoreSecrets() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccountKeyDatastoreSecrets class. + /// + /// Storage account key. + public AccountKeyDatastoreSecrets(string key = default(string)) + { + Key = key; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets storage account key. + /// + [JsonProperty(PropertyName = "key")] + public string Key { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AksComputeSecrets.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AksComputeSecrets.cs new file mode 100644 index 000000000000..928dc31c0014 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AksComputeSecrets.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Secrets related to a Machine Learning compute based on AKS. + /// + [Newtonsoft.Json.JsonObject("AKS")] + public partial class AksComputeSecrets : ComputeSecrets + { + /// + /// Initializes a new instance of the AksComputeSecrets class. + /// + public AksComputeSecrets() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AksComputeSecrets class. + /// + /// Content of kubeconfig file that can be + /// used to connect to the Kubernetes cluster. + /// Content of kubeconfig file that can + /// be used to connect to the Kubernetes cluster. + /// Image registry pull + /// secret. + public AksComputeSecrets(string userKubeConfig = default(string), string adminKubeConfig = default(string), string imagePullSecretName = default(string)) + { + UserKubeConfig = userKubeConfig; + AdminKubeConfig = adminKubeConfig; + ImagePullSecretName = imagePullSecretName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets content of kubeconfig file that can be used to connect + /// to the Kubernetes cluster. + /// + [JsonProperty(PropertyName = "userKubeConfig")] + public string UserKubeConfig { get; set; } + + /// + /// Gets or sets content of kubeconfig file that can be used to connect + /// to the Kubernetes cluster. + /// + [JsonProperty(PropertyName = "adminKubeConfig")] + public string AdminKubeConfig { get; set; } + + /// + /// Gets or sets image registry pull secret. + /// + [JsonProperty(PropertyName = "imagePullSecretName")] + public string ImagePullSecretName { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AksNetworkingConfiguration.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AksNetworkingConfiguration.cs new file mode 100644 index 000000000000..0bf64b74556d --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AksNetworkingConfiguration.cs @@ -0,0 +1,119 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Advance configuration for AKS networking + /// + public partial class AksNetworkingConfiguration + { + /// + /// Initializes a new instance of the AksNetworkingConfiguration class. + /// + public AksNetworkingConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AksNetworkingConfiguration class. + /// + /// Virtual network subnet resource ID the + /// compute nodes belong to + /// A CIDR notation IP range from which to + /// assign service cluster IPs. It must not overlap with any Subnet IP + /// ranges. + /// An IP address assigned to the Kubernetes + /// DNS service. It must be within the Kubernetes service address range + /// specified in serviceCidr. + /// A CIDR notation IP range assigned to + /// the Docker bridge network. It must not overlap with any Subnet IP + /// ranges or the Kubernetes service address range. + public AksNetworkingConfiguration(string subnetId = default(string), string serviceCidr = default(string), string dnsServiceIP = default(string), string dockerBridgeCidr = default(string)) + { + SubnetId = subnetId; + ServiceCidr = serviceCidr; + DnsServiceIP = dnsServiceIP; + DockerBridgeCidr = dockerBridgeCidr; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets virtual network subnet resource ID the compute nodes + /// belong to + /// + [JsonProperty(PropertyName = "subnetId")] + public string SubnetId { get; set; } + + /// + /// Gets or sets a CIDR notation IP range from which to assign service + /// cluster IPs. It must not overlap with any Subnet IP ranges. + /// + [JsonProperty(PropertyName = "serviceCidr")] + public string ServiceCidr { get; set; } + + /// + /// Gets or sets an IP address assigned to the Kubernetes DNS service. + /// It must be within the Kubernetes service address range specified in + /// serviceCidr. + /// + [JsonProperty(PropertyName = "dnsServiceIP")] + public string DnsServiceIP { get; set; } + + /// + /// Gets or sets a CIDR notation IP range assigned to the Docker bridge + /// network. It must not overlap with any Subnet IP ranges or the + /// Kubernetes service address range. + /// + [JsonProperty(PropertyName = "dockerBridgeCidr")] + public string DockerBridgeCidr { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ServiceCidr != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(ServiceCidr, "^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$")) + { + throw new ValidationException(ValidationRules.Pattern, "ServiceCidr", "^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$"); + } + } + if (DnsServiceIP != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(DnsServiceIP, "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$")) + { + throw new ValidationException(ValidationRules.Pattern, "DnsServiceIP", "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"); + } + } + if (DockerBridgeCidr != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(DockerBridgeCidr, "^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$")) + { + throw new ValidationException(ValidationRules.Pattern, "DockerBridgeCidr", "^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AllocationState.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AllocationState.cs new file mode 100644 index 000000000000..87578396374d --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AllocationState.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for AllocationState. + /// + public static class AllocationState + { + public const string Steady = "Steady"; + public const string Resizing = "Resizing"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AmlCompute.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AmlCompute.cs new file mode 100644 index 000000000000..b7c08f2835c8 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AmlCompute.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Azure Machine Learning compute. + /// + public partial class AmlCompute : Compute + { + /// + /// Initializes a new instance of the AmlCompute class. + /// + public AmlCompute() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AmlCompute class. + /// + /// Location for the underlying + /// compute + /// The provision state of the cluster. + /// Valid values are Unknown, Updating, Provisioning, Succeeded, and + /// Failed. Possible values include: 'Unknown', 'Updating', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// The description of the Machine Learning + /// compute. + /// The time at which the compute was + /// created. + /// The time at which the compute was last + /// modified. + /// ARM resource id of the underlying + /// compute + /// Errors during provisioning + /// Indicating whether the compute was + /// provisioned by user and brought from outside if true, or machine + /// learning service provisioned it if false. + /// Opt-out of local authentication and + /// ensure customers can use only MSI and AAD exclusively for + /// authentication. + /// AML Compute properties + public AmlCompute(string computeLocation = default(string), string provisioningState = default(string), string description = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? modifiedOn = default(System.DateTime?), string resourceId = default(string), IList provisioningErrors = default(IList), bool? isAttachedCompute = default(bool?), bool? disableLocalAuth = default(bool?), AmlComputeProperties properties = default(AmlComputeProperties)) + : base(computeLocation, provisioningState, description, createdOn, modifiedOn, resourceId, provisioningErrors, isAttachedCompute, disableLocalAuth) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets AML Compute properties + /// + [JsonProperty(PropertyName = "properties")] + public AmlComputeProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AmlComputeNodeInformation.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AmlComputeNodeInformation.cs new file mode 100644 index 000000000000..56dafcdf7fbf --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AmlComputeNodeInformation.cs @@ -0,0 +1,112 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Compute node information related to a AmlCompute. + /// + public partial class AmlComputeNodeInformation + { + /// + /// Initializes a new instance of the AmlComputeNodeInformation class. + /// + public AmlComputeNodeInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AmlComputeNodeInformation class. + /// + /// Node ID. + /// Private IP address. + /// Public IP address. + /// Port. + /// State of the compute node. Values are idle, + /// running, preparing, unusable, leaving and preempted. Possible + /// values include: 'idle', 'running', 'preparing', 'unusable', + /// 'leaving', 'preempted' + /// Run ID. + public AmlComputeNodeInformation(string nodeId = default(string), string privateIpAddress = default(string), string publicIpAddress = default(string), double? port = default(double?), string nodeState = default(string), string runId = default(string)) + { + NodeId = nodeId; + PrivateIpAddress = privateIpAddress; + PublicIpAddress = publicIpAddress; + Port = port; + NodeState = nodeState; + RunId = runId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets node ID. + /// + /// + /// ID of the compute node. + /// + [JsonProperty(PropertyName = "nodeId")] + public string NodeId { get; private set; } + + /// + /// Gets private IP address. + /// + /// + /// Private IP address of the compute node. + /// + [JsonProperty(PropertyName = "privateIpAddress")] + public string PrivateIpAddress { get; private set; } + + /// + /// Gets public IP address. + /// + /// + /// Public IP address of the compute node. + /// + [JsonProperty(PropertyName = "publicIpAddress")] + public string PublicIpAddress { get; private set; } + + /// + /// Gets port. + /// + /// + /// SSH port number of the node. + /// + [JsonProperty(PropertyName = "port")] + public double? Port { get; private set; } + + /// + /// Gets state of the compute node. Values are idle, running, + /// preparing, unusable, leaving and preempted. Possible values + /// include: 'idle', 'running', 'preparing', 'unusable', 'leaving', + /// 'preempted' + /// + [JsonProperty(PropertyName = "nodeState")] + public string NodeState { get; private set; } + + /// + /// Gets run ID. + /// + /// + /// ID of the Experiment running on the node, if any else null. + /// + [JsonProperty(PropertyName = "runId")] + public string RunId { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AmlComputeProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AmlComputeProperties.cs new file mode 100644 index 000000000000..dc8821e171ee --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AmlComputeProperties.cs @@ -0,0 +1,260 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// AML Compute properties + /// + public partial class AmlComputeProperties + { + /// + /// Initializes a new instance of the AmlComputeProperties class. + /// + public AmlComputeProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AmlComputeProperties class. + /// + /// Compute OS Type. Possible values include: + /// 'Linux', 'Windows' + /// Virtual Machine Size + /// Virtual Machine priority. Possible values + /// include: 'Dedicated', 'LowPriority' + /// Virtual Machine image for AML + /// Compute - windows only + /// Network is isolated or not + /// Scale settings for AML Compute + /// User account + /// credentials. + /// Subnet. + /// Close remote Login Access + /// Port + /// Allocation state. + /// Allocation state + /// transition time. + /// Errors. + /// Current node count. + /// Target node count. + /// Node state counts. + /// Enable node public IP. + public AmlComputeProperties(string osType = default(string), string vmSize = default(string), string vmPriority = default(string), VirtualMachineImage virtualMachineImage = default(VirtualMachineImage), bool? isolatedNetwork = default(bool?), ScaleSettings scaleSettings = default(ScaleSettings), UserAccountCredentials userAccountCredentials = default(UserAccountCredentials), ResourceId subnet = default(ResourceId), string remoteLoginPortPublicAccess = default(string), string allocationState = default(string), System.DateTime? allocationStateTransitionTime = default(System.DateTime?), IList errors = default(IList), int? currentNodeCount = default(int?), int? targetNodeCount = default(int?), NodeStateCounts nodeStateCounts = default(NodeStateCounts), bool? enableNodePublicIp = default(bool?)) + { + OsType = osType; + VmSize = vmSize; + VmPriority = vmPriority; + VirtualMachineImage = virtualMachineImage; + IsolatedNetwork = isolatedNetwork; + ScaleSettings = scaleSettings; + UserAccountCredentials = userAccountCredentials; + Subnet = subnet; + RemoteLoginPortPublicAccess = remoteLoginPortPublicAccess; + AllocationState = allocationState; + AllocationStateTransitionTime = allocationStateTransitionTime; + Errors = errors; + CurrentNodeCount = currentNodeCount; + TargetNodeCount = targetNodeCount; + NodeStateCounts = nodeStateCounts; + EnableNodePublicIp = enableNodePublicIp; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets compute OS Type. Possible values include: 'Linux', + /// 'Windows' + /// + [JsonProperty(PropertyName = "osType")] + public string OsType { get; set; } + + /// + /// Gets or sets virtual Machine Size + /// + [JsonProperty(PropertyName = "vmSize")] + public string VmSize { get; set; } + + /// + /// Gets or sets virtual Machine priority. Possible values include: + /// 'Dedicated', 'LowPriority' + /// + [JsonProperty(PropertyName = "vmPriority")] + public string VmPriority { get; set; } + + /// + /// Gets or sets virtual Machine image for AML Compute - windows only + /// + [JsonProperty(PropertyName = "virtualMachineImage")] + public VirtualMachineImage VirtualMachineImage { get; set; } + + /// + /// Gets or sets network is isolated or not + /// + [JsonProperty(PropertyName = "isolatedNetwork")] + public bool? IsolatedNetwork { get; set; } + + /// + /// Gets or sets scale settings for AML Compute + /// + [JsonProperty(PropertyName = "scaleSettings")] + public ScaleSettings ScaleSettings { get; set; } + + /// + /// Gets or sets user account credentials. + /// + /// + /// Credentials for an administrator user account that will be created + /// on each compute node. + /// + [JsonProperty(PropertyName = "userAccountCredentials")] + public UserAccountCredentials UserAccountCredentials { get; set; } + + /// + /// Gets or sets subnet. + /// + /// + /// Virtual network subnet resource ID the compute nodes belong to. + /// + [JsonProperty(PropertyName = "subnet")] + public ResourceId Subnet { get; set; } + + /// + /// Gets or sets close remote Login Access Port + /// + /// + /// State of the public SSH port. Possible values are: Disabled - + /// Indicates that the public ssh port is closed on all nodes of the + /// cluster. Enabled - Indicates that the public ssh port is open on + /// all nodes of the cluster. NotSpecified - Indicates that the public + /// ssh port is closed on all nodes of the cluster if VNet is defined, + /// else is open all public nodes. It can be default only during + /// cluster creation time, after creation it will be either enabled or + /// disabled. Possible values include: 'Enabled', 'Disabled', + /// 'NotSpecified' + /// + [JsonProperty(PropertyName = "remoteLoginPortPublicAccess")] + public string RemoteLoginPortPublicAccess { get; set; } + + /// + /// Gets allocation state. + /// + /// + /// Allocation state of the compute. Possible values are: steady - + /// Indicates that the compute is not resizing. There are no changes to + /// the number of compute nodes in the compute in progress. A compute + /// enters this state when it is created and when no operations are + /// being performed on the compute to change the number of compute + /// nodes. resizing - Indicates that the compute is resizing; that is, + /// compute nodes are being added to or removed from the compute. + /// Possible values include: 'Steady', 'Resizing' + /// + [JsonProperty(PropertyName = "allocationState")] + public string AllocationState { get; private set; } + + /// + /// Gets allocation state transition time. + /// + /// + /// The time at which the compute entered its current allocation state. + /// + [JsonProperty(PropertyName = "allocationStateTransitionTime")] + public System.DateTime? AllocationStateTransitionTime { get; private set; } + + /// + /// Gets errors. + /// + /// + /// Collection of errors encountered by various compute nodes during + /// node setup. + /// + [JsonProperty(PropertyName = "errors")] + public IList Errors { get; private set; } + + /// + /// Gets current node count. + /// + /// + /// The number of compute nodes currently assigned to the compute. + /// + [JsonProperty(PropertyName = "currentNodeCount")] + public int? CurrentNodeCount { get; private set; } + + /// + /// Gets target node count. + /// + /// + /// The target number of compute nodes for the compute. If the + /// allocationState is resizing, this property denotes the target node + /// count for the ongoing resize operation. If the allocationState is + /// steady, this property denotes the target node count for the + /// previous resize operation. + /// + [JsonProperty(PropertyName = "targetNodeCount")] + public int? TargetNodeCount { get; private set; } + + /// + /// Gets node state counts. + /// + /// + /// Counts of various node states on the compute. + /// + [JsonProperty(PropertyName = "nodeStateCounts")] + public NodeStateCounts NodeStateCounts { get; private set; } + + /// + /// Gets or sets enable node public IP. + /// + /// + /// Enable or disable node public IP address provisioning. Possible + /// values are: Possible values are: true - Indicates that the compute + /// nodes will have public IPs provisioned. false - Indicates that the + /// compute nodes will have a private endpoint and no public IPs. + /// + [JsonProperty(PropertyName = "enableNodePublicIp")] + public bool? EnableNodePublicIp { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (VirtualMachineImage != null) + { + VirtualMachineImage.Validate(); + } + if (ScaleSettings != null) + { + ScaleSettings.Validate(); + } + if (UserAccountCredentials != null) + { + UserAccountCredentials.Validate(); + } + if (Subnet != null) + { + Subnet.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AmlToken.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AmlToken.cs new file mode 100644 index 000000000000..4e09742e6a68 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AmlToken.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// AML Token identity configuration. + /// + [Newtonsoft.Json.JsonObject("AMLToken")] + public partial class AmlToken : IdentityConfiguration + { + /// + /// Initializes a new instance of the AmlToken class. + /// + public AmlToken() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AmlUserFeature.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AmlUserFeature.cs new file mode 100644 index 000000000000..e22d752edf7a --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AmlUserFeature.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Features enabled for a workspace + /// + public partial class AmlUserFeature + { + /// + /// Initializes a new instance of the AmlUserFeature class. + /// + public AmlUserFeature() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AmlUserFeature class. + /// + /// Specifies the feature ID + /// Specifies the feature name + /// Describes the feature for user + /// experience + public AmlUserFeature(string id = default(string), string displayName = default(string), string description = default(string)) + { + Id = id; + DisplayName = displayName; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the feature ID + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets specifies the feature name + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets describes the feature for user experience + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ApplicationSharingPolicy.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ApplicationSharingPolicy.cs new file mode 100644 index 000000000000..2e090b18400e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ApplicationSharingPolicy.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ApplicationSharingPolicy. + /// + public static class ApplicationSharingPolicy + { + public const string Personal = "Personal"; + public const string Shared = "Shared"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AssetReferenceBase.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AssetReferenceBase.cs new file mode 100644 index 000000000000..c41a0dc17b5c --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AssetReferenceBase.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.Azure.Management.MachineLearningServices.Models +{ + using System.Linq; + + /// + /// Base definition for asset references. + /// + public partial class AssetReferenceBase + { + /// + /// Initializes a new instance of the AssetReferenceBase class. + /// + public AssetReferenceBase() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AssignedUser.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AssignedUser.cs new file mode 100644 index 000000000000..0aabf3cf72c2 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AssignedUser.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A user that can be assigned to a compute instance. + /// + public partial class AssignedUser + { + /// + /// Initializes a new instance of the AssignedUser class. + /// + public AssignedUser() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AssignedUser class. + /// + /// User’s AAD Object Id. + /// User’s AAD Tenant Id. + public AssignedUser(string objectId, string tenantId) + { + ObjectId = objectId; + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets user’s AAD Object Id. + /// + [JsonProperty(PropertyName = "objectId")] + public string ObjectId { get; set; } + + /// + /// Gets or sets user’s AAD Tenant Id. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ObjectId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ObjectId"); + } + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AutoPauseProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AutoPauseProperties.cs new file mode 100644 index 000000000000..e17f504d791d --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AutoPauseProperties.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Auto pause properties + /// + public partial class AutoPauseProperties + { + /// + /// Initializes a new instance of the AutoPauseProperties class. + /// + public AutoPauseProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoPauseProperties class. + /// + public AutoPauseProperties(int? delayInMinutes = default(int?), bool? enabled = default(bool?)) + { + DelayInMinutes = delayInMinutes; + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "delayInMinutes")] + public int? DelayInMinutes { get; set; } + + /// + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AutoScaleProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AutoScaleProperties.cs new file mode 100644 index 000000000000..6fc2dcdb3b5f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AutoScaleProperties.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Auto scale properties + /// + public partial class AutoScaleProperties + { + /// + /// Initializes a new instance of the AutoScaleProperties class. + /// + public AutoScaleProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoScaleProperties class. + /// + public AutoScaleProperties(int? minNodeCount = default(int?), bool? enabled = default(bool?), int? maxNodeCount = default(int?)) + { + MinNodeCount = minNodeCount; + Enabled = enabled; + MaxNodeCount = maxNodeCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "minNodeCount")] + public int? MinNodeCount { get; set; } + + /// + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// + [JsonProperty(PropertyName = "maxNodeCount")] + public int? MaxNodeCount { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AutoScaleSettings.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AutoScaleSettings.cs new file mode 100644 index 000000000000..d1e48181861e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AutoScaleSettings.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + [Newtonsoft.Json.JsonObject("Auto")] + public partial class AutoScaleSettings : OnlineScaleSettings + { + /// + /// Initializes a new instance of the AutoScaleSettings class. + /// + public AutoScaleSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoScaleSettings class. + /// + /// Maximum number of instances for this + /// deployment. + /// Minimum number of instances for this + /// deployment. + /// The polling interval in ISO 8691 + /// format. Only supports duration with precision as low as + /// Seconds. + /// Target CPU usage for the + /// autoscaler. + public AutoScaleSettings(int? maxInstances = default(int?), int? minInstances = default(int?), System.TimeSpan? pollingInterval = default(System.TimeSpan?), int? targetUtilizationPercentage = default(int?)) + : base(maxInstances, minInstances) + { + PollingInterval = pollingInterval; + TargetUtilizationPercentage = targetUtilizationPercentage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the polling interval in ISO 8691 format. Only supports + /// duration with precision as low as Seconds. + /// + [JsonProperty(PropertyName = "pollingInterval")] + public System.TimeSpan? PollingInterval { get; set; } + + /// + /// Gets or sets target CPU usage for the autoscaler. + /// + [JsonProperty(PropertyName = "targetUtilizationPercentage")] + public int? TargetUtilizationPercentage { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureBlobContents.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureBlobContents.cs new file mode 100644 index 000000000000..953b640091e0 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureBlobContents.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Blob datastore configuration. + /// + [Newtonsoft.Json.JsonObject("AzureBlob")] + public partial class AzureBlobContents : DatastoreContents + { + /// + /// Initializes a new instance of the AzureBlobContents class. + /// + public AzureBlobContents() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureBlobContents class. + /// + /// Storage account name. + /// Storage account container name. + /// Account credentials. + /// Azure cloud endpoint for the storage + /// account. + /// Protocol used to communicate with the + /// storage account. + public AzureBlobContents(string accountName, string containerName, DatastoreCredentials credentials, string endpoint, string protocol) + { + AccountName = accountName; + ContainerName = containerName; + Credentials = credentials; + Endpoint = endpoint; + Protocol = protocol; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets storage account name. + /// + [JsonProperty(PropertyName = "accountName")] + public string AccountName { get; set; } + + /// + /// Gets or sets storage account container name. + /// + [JsonProperty(PropertyName = "containerName")] + public string ContainerName { get; set; } + + /// + /// Gets or sets account credentials. + /// + [JsonProperty(PropertyName = "credentials")] + public DatastoreCredentials Credentials { get; set; } + + /// + /// Gets or sets azure cloud endpoint for the storage account. + /// + [JsonProperty(PropertyName = "endpoint")] + public string Endpoint { get; set; } + + /// + /// Gets or sets protocol used to communicate with the storage account. + /// + [JsonProperty(PropertyName = "protocol")] + public string Protocol { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AccountName"); + } + if (ContainerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ContainerName"); + } + if (Credentials == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Credentials"); + } + if (Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Endpoint"); + } + if (Protocol == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Protocol"); + } + if (AccountName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(AccountName, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "AccountName", "[a-zA-Z0-9_]"); + } + } + if (ContainerName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(ContainerName, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "ContainerName", "[a-zA-Z0-9_]"); + } + } + if (Endpoint != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Endpoint, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Endpoint", "[a-zA-Z0-9_]"); + } + } + if (Protocol != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Protocol, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Protocol", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureDataLakeGen1Contents.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureDataLakeGen1Contents.cs new file mode 100644 index 000000000000..3e57405ee1a8 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureDataLakeGen1Contents.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Data Lake Gen1 datastore configuration. + /// + [Newtonsoft.Json.JsonObject("AzureDataLakeGen1")] + public partial class AzureDataLakeGen1Contents : DatastoreContents + { + /// + /// Initializes a new instance of the AzureDataLakeGen1Contents class. + /// + public AzureDataLakeGen1Contents() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureDataLakeGen1Contents class. + /// + /// Account credentials. + /// Azure Data Lake store name. + public AzureDataLakeGen1Contents(DatastoreCredentials credentials, string storeName) + { + Credentials = credentials; + StoreName = storeName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets account credentials. + /// + [JsonProperty(PropertyName = "credentials")] + public DatastoreCredentials Credentials { get; set; } + + /// + /// Gets or sets azure Data Lake store name. + /// + [JsonProperty(PropertyName = "storeName")] + public string StoreName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Credentials == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Credentials"); + } + if (StoreName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StoreName"); + } + if (StoreName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(StoreName, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "StoreName", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureDataLakeGen2Contents.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureDataLakeGen2Contents.cs new file mode 100644 index 000000000000..a4d3970df769 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureDataLakeGen2Contents.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Data Lake Gen2 datastore configuration. + /// + [Newtonsoft.Json.JsonObject("AzureDataLakeGen2")] + public partial class AzureDataLakeGen2Contents : DatastoreContents + { + /// + /// Initializes a new instance of the AzureDataLakeGen2Contents class. + /// + public AzureDataLakeGen2Contents() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureDataLakeGen2Contents class. + /// + /// Storage account name. + /// Storage account container name. + /// Account credentials. + /// Azure cloud endpoint for the storage + /// account. + /// Protocol used to communicate with the + /// storage account. + public AzureDataLakeGen2Contents(string accountName, string containerName, DatastoreCredentials credentials, string endpoint, string protocol) + { + AccountName = accountName; + ContainerName = containerName; + Credentials = credentials; + Endpoint = endpoint; + Protocol = protocol; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets storage account name. + /// + [JsonProperty(PropertyName = "accountName")] + public string AccountName { get; set; } + + /// + /// Gets or sets storage account container name. + /// + [JsonProperty(PropertyName = "containerName")] + public string ContainerName { get; set; } + + /// + /// Gets or sets account credentials. + /// + [JsonProperty(PropertyName = "credentials")] + public DatastoreCredentials Credentials { get; set; } + + /// + /// Gets or sets azure cloud endpoint for the storage account. + /// + [JsonProperty(PropertyName = "endpoint")] + public string Endpoint { get; set; } + + /// + /// Gets or sets protocol used to communicate with the storage account. + /// + [JsonProperty(PropertyName = "protocol")] + public string Protocol { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AccountName"); + } + if (ContainerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ContainerName"); + } + if (Credentials == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Credentials"); + } + if (Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Endpoint"); + } + if (Protocol == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Protocol"); + } + if (AccountName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(AccountName, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "AccountName", "[a-zA-Z0-9_]"); + } + } + if (ContainerName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(ContainerName, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "ContainerName", "[a-zA-Z0-9_]"); + } + } + if (Endpoint != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Endpoint, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Endpoint", "[a-zA-Z0-9_]"); + } + } + if (Protocol != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Protocol, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Protocol", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureEntityResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureEntityResource.cs new file mode 100644 index 000000000000..8be7cf8033dd --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureEntityResource.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.Azure.Management.MachineLearningServices.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" + /// Resource Etag. + public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + : base(id, name, type) + { + 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureFileContents.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureFileContents.cs new file mode 100644 index 000000000000..500a31afd285 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureFileContents.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure File datastore configuration. + /// + [Newtonsoft.Json.JsonObject("AzureFile")] + public partial class AzureFileContents : DatastoreContents + { + /// + /// Initializes a new instance of the AzureFileContents class. + /// + public AzureFileContents() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureFileContents class. + /// + /// Storage account name. + /// Storage account container name. + /// Account credentials. + /// Azure cloud endpoint for the storage + /// account. + /// Protocol used to communicate with the + /// storage account. + public AzureFileContents(string accountName, string containerName, DatastoreCredentials credentials, string endpoint, string protocol) + { + AccountName = accountName; + ContainerName = containerName; + Credentials = credentials; + Endpoint = endpoint; + Protocol = protocol; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets storage account name. + /// + [JsonProperty(PropertyName = "accountName")] + public string AccountName { get; set; } + + /// + /// Gets or sets storage account container name. + /// + [JsonProperty(PropertyName = "containerName")] + public string ContainerName { get; set; } + + /// + /// Gets or sets account credentials. + /// + [JsonProperty(PropertyName = "credentials")] + public DatastoreCredentials Credentials { get; set; } + + /// + /// Gets or sets azure cloud endpoint for the storage account. + /// + [JsonProperty(PropertyName = "endpoint")] + public string Endpoint { get; set; } + + /// + /// Gets or sets protocol used to communicate with the storage account. + /// + [JsonProperty(PropertyName = "protocol")] + public string Protocol { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AccountName"); + } + if (ContainerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ContainerName"); + } + if (Credentials == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Credentials"); + } + if (Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Endpoint"); + } + if (Protocol == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Protocol"); + } + if (AccountName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(AccountName, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "AccountName", "[a-zA-Z0-9_]"); + } + } + if (ContainerName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(ContainerName, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "ContainerName", "[a-zA-Z0-9_]"); + } + } + if (Endpoint != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Endpoint, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Endpoint", "[a-zA-Z0-9_]"); + } + } + if (Protocol != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Protocol, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Protocol", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzurePostgreSqlContents.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzurePostgreSqlContents.cs new file mode 100644 index 000000000000..3c738fbe6066 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzurePostgreSqlContents.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Postgre SQL datastore configuration. + /// + [Newtonsoft.Json.JsonObject("AzurePostgreSql")] + public partial class AzurePostgreSqlContents : DatastoreContents + { + /// + /// Initializes a new instance of the AzurePostgreSqlContents class. + /// + public AzurePostgreSqlContents() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzurePostgreSqlContents class. + /// + /// Account credentials. + /// Azure SQL database name. + /// Azure cloud endpoint for the + /// database. + /// Azure SQL server port. + /// Azure SQL server name. + /// Whether the Azure PostgreSQL server + /// requires SSL. + public AzurePostgreSqlContents(DatastoreCredentials credentials, string databaseName, string endpoint, int portNumber, string serverName, bool? enableSSL = default(bool?)) + { + Credentials = credentials; + DatabaseName = databaseName; + EnableSSL = enableSSL; + Endpoint = endpoint; + PortNumber = portNumber; + ServerName = serverName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets account credentials. + /// + [JsonProperty(PropertyName = "credentials")] + public DatastoreCredentials Credentials { get; set; } + + /// + /// Gets or sets azure SQL database name. + /// + [JsonProperty(PropertyName = "databaseName")] + public string DatabaseName { get; set; } + + /// + /// Gets or sets whether the Azure PostgreSQL server requires SSL. + /// + [JsonProperty(PropertyName = "enableSSL")] + public bool? EnableSSL { get; set; } + + /// + /// Gets or sets azure cloud endpoint for the database. + /// + [JsonProperty(PropertyName = "endpoint")] + public string Endpoint { get; set; } + + /// + /// Gets or sets azure SQL server port. + /// + [JsonProperty(PropertyName = "portNumber")] + public int PortNumber { get; set; } + + /// + /// Gets or sets azure SQL server name. + /// + [JsonProperty(PropertyName = "serverName")] + public string ServerName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Credentials == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Credentials"); + } + if (DatabaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DatabaseName"); + } + if (Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Endpoint"); + } + if (ServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ServerName"); + } + if (DatabaseName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(DatabaseName, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "DatabaseName", "[a-zA-Z0-9_]"); + } + } + if (Endpoint != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Endpoint, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Endpoint", "[a-zA-Z0-9_]"); + } + } + if (ServerName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(ServerName, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "ServerName", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureSqlDatabaseContents.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureSqlDatabaseContents.cs new file mode 100644 index 000000000000..7a5fb50fafc0 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/AzureSqlDatabaseContents.cs @@ -0,0 +1,132 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure SQL Database datastore configuration. + /// + [Newtonsoft.Json.JsonObject("AzureSqlDatabase")] + public partial class AzureSqlDatabaseContents : DatastoreContents + { + /// + /// Initializes a new instance of the AzureSqlDatabaseContents class. + /// + public AzureSqlDatabaseContents() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureSqlDatabaseContents class. + /// + /// Account credentials. + /// Azure SQL database name. + /// Azure cloud endpoint for the + /// database. + /// Azure SQL server port. + /// Azure SQL server name. + public AzureSqlDatabaseContents(DatastoreCredentials credentials, string databaseName, string endpoint, int portNumber, string serverName) + { + Credentials = credentials; + DatabaseName = databaseName; + Endpoint = endpoint; + PortNumber = portNumber; + ServerName = serverName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets account credentials. + /// + [JsonProperty(PropertyName = "credentials")] + public DatastoreCredentials Credentials { get; set; } + + /// + /// Gets or sets azure SQL database name. + /// + [JsonProperty(PropertyName = "databaseName")] + public string DatabaseName { get; set; } + + /// + /// Gets or sets azure cloud endpoint for the database. + /// + [JsonProperty(PropertyName = "endpoint")] + public string Endpoint { get; set; } + + /// + /// Gets or sets azure SQL server port. + /// + [JsonProperty(PropertyName = "portNumber")] + public int PortNumber { get; set; } + + /// + /// Gets or sets azure SQL server name. + /// + [JsonProperty(PropertyName = "serverName")] + public string ServerName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Credentials == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Credentials"); + } + if (DatabaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DatabaseName"); + } + if (Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Endpoint"); + } + if (ServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ServerName"); + } + if (DatabaseName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(DatabaseName, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "DatabaseName", "[a-zA-Z0-9_]"); + } + } + if (Endpoint != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Endpoint, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Endpoint", "[a-zA-Z0-9_]"); + } + } + if (ServerName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(ServerName, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "ServerName", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BanditPolicy.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BanditPolicy.cs new file mode 100644 index 000000000000..a34d742075cc --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BanditPolicy.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines an early termination policy based on slack criteria, and a + /// frequency and delay interval for evaluation. + /// + [Newtonsoft.Json.JsonObject("Bandit")] + public partial class BanditPolicy : EarlyTerminationPolicy + { + /// + /// Initializes a new instance of the BanditPolicy class. + /// + public BanditPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BanditPolicy class. + /// + /// Number of intervals by which to delay + /// the first evaluation. + /// Interval (number of runs) between + /// policy evaluations. + /// Absolute distance allowed from the best + /// performing run. + /// Ratio of the allowed distance from the + /// best performing run. + public BanditPolicy(int? delayEvaluation = default(int?), int? evaluationInterval = default(int?), double? slackAmount = default(double?), double? slackFactor = default(double?)) + : base(delayEvaluation, evaluationInterval) + { + SlackAmount = slackAmount; + SlackFactor = slackFactor; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets absolute distance allowed from the best performing + /// run. + /// + [JsonProperty(PropertyName = "slackAmount")] + public double? SlackAmount { get; set; } + + /// + /// Gets or sets ratio of the allowed distance from the best performing + /// run. + /// + [JsonProperty(PropertyName = "slackFactor")] + public double? SlackFactor { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchDeployment.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchDeployment.cs new file mode 100644 index 000000000000..bafc3d38d67e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchDeployment.cs @@ -0,0 +1,199 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Batch inference settings per deployment. + /// + public partial class BatchDeployment + { + /// + /// Initializes a new instance of the BatchDeployment class. + /// + public BatchDeployment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchDeployment class. + /// + /// Code configuration for the endpoint + /// deployment. + /// Configuration for compute binding. + /// Description of the endpoint + /// deployment. + /// ARM resource ID of the environment + /// specification for the endpoint deployment. + /// Environment variables + /// configuration for the deployment. + /// Error threshold, if the error count + /// for the entire input goes above this value, + /// the batch inference will be aborted. Range is [-1, int.MaxValue]. + /// For FileDataset, this value is the count of file failures. + /// For TabularDataset, this value is the count of record failures. + /// If set to -1 (the lower bound), all failures during batch inference + /// will be ignored. + /// Logging level for batch inference + /// operation. Possible values include: 'Info', 'Warning', + /// 'Debug' + /// Size of the mini-batch passed to each + /// batch invocation. + /// For FileDataset, this is the number of files per mini-batch. + /// For TabularDataset, this is the size of the records in bytes, per + /// mini-batch. + /// Reference to the model asset for the endpoint + /// deployment. + /// Output configuration for the + /// batch inference operation. + /// Partition keys list used for Named + /// partitioning. + /// Property dictionary. Properties can be + /// added, but not removed or altered. + /// Retry Settings for the batch inference + /// operation. + public BatchDeployment(CodeConfiguration codeConfiguration = default(CodeConfiguration), ComputeConfiguration compute = default(ComputeConfiguration), string description = default(string), string environmentId = default(string), IDictionary environmentVariables = default(IDictionary), int? errorThreshold = default(int?), string loggingLevel = default(string), long? miniBatchSize = default(long?), AssetReferenceBase model = default(AssetReferenceBase), BatchOutputConfiguration outputConfiguration = default(BatchOutputConfiguration), IList partitionKeys = default(IList), IDictionary properties = default(IDictionary), BatchRetrySettings retrySettings = default(BatchRetrySettings)) + { + CodeConfiguration = codeConfiguration; + Compute = compute; + Description = description; + EnvironmentId = environmentId; + EnvironmentVariables = environmentVariables; + ErrorThreshold = errorThreshold; + LoggingLevel = loggingLevel; + MiniBatchSize = miniBatchSize; + Model = model; + OutputConfiguration = outputConfiguration; + PartitionKeys = partitionKeys; + Properties = properties; + RetrySettings = retrySettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets code configuration for the endpoint deployment. + /// + [JsonProperty(PropertyName = "codeConfiguration")] + public CodeConfiguration CodeConfiguration { get; set; } + + /// + /// Gets or sets configuration for compute binding. + /// + [JsonProperty(PropertyName = "compute")] + public ComputeConfiguration Compute { get; set; } + + /// + /// Gets or sets description of the endpoint deployment. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets ARM resource ID of the environment specification for + /// the endpoint deployment. + /// + [JsonProperty(PropertyName = "environmentId")] + public string EnvironmentId { get; set; } + + /// + /// Gets or sets environment variables configuration for the + /// deployment. + /// + [JsonProperty(PropertyName = "environmentVariables")] + public IDictionary EnvironmentVariables { get; set; } + + /// + /// Gets or sets error threshold, if the error count for the entire + /// input goes above this value, + /// the batch inference will be aborted. Range is [-1, int.MaxValue]. + /// For FileDataset, this value is the count of file failures. + /// For TabularDataset, this value is the count of record failures. + /// If set to -1 (the lower bound), all failures during batch inference + /// will be ignored. + /// + [JsonProperty(PropertyName = "errorThreshold")] + public int? ErrorThreshold { get; set; } + + /// + /// Gets or sets logging level for batch inference operation. Possible + /// values include: 'Info', 'Warning', 'Debug' + /// + [JsonProperty(PropertyName = "loggingLevel")] + public string LoggingLevel { get; set; } + + /// + /// Gets or sets size of the mini-batch passed to each batch + /// invocation. + /// For FileDataset, this is the number of files per mini-batch. + /// For TabularDataset, this is the size of the records in bytes, per + /// mini-batch. + /// + [JsonProperty(PropertyName = "miniBatchSize")] + public long? MiniBatchSize { get; set; } + + /// + /// Gets or sets reference to the model asset for the endpoint + /// deployment. + /// + [JsonProperty(PropertyName = "model")] + public AssetReferenceBase Model { get; set; } + + /// + /// Gets or sets output configuration for the batch inference + /// operation. + /// + [JsonProperty(PropertyName = "outputConfiguration")] + public BatchOutputConfiguration OutputConfiguration { get; set; } + + /// + /// Gets or sets partition keys list used for Named partitioning. + /// + [JsonProperty(PropertyName = "partitionKeys")] + public IList PartitionKeys { get; set; } + + /// + /// Gets or sets property dictionary. Properties can be added, but not + /// removed or altered. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets or sets retry Settings for the batch inference operation. + /// + [JsonProperty(PropertyName = "retrySettings")] + public BatchRetrySettings RetrySettings { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CodeConfiguration != null) + { + CodeConfiguration.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchDeploymentTrackedResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchDeploymentTrackedResource.cs new file mode 100644 index 000000000000..87c2bd5a8c4d --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchDeploymentTrackedResource.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class BatchDeploymentTrackedResource : TrackedResource + { + /// + /// Initializes a new instance of the BatchDeploymentTrackedResource + /// class. + /// + public BatchDeploymentTrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchDeploymentTrackedResource + /// class. + /// + /// The geo-location where the resource + /// lives + /// Additional attributes of the + /// entity. + /// 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" + /// Resource tags. + /// Service identity associated with a + /// resource. + /// Metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// System data associated with resource + /// provider + public BatchDeploymentTrackedResource(string location, BatchDeployment properties, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentity identity = default(ResourceIdentity), string kind = default(string), SystemData systemData = default(SystemData)) + : base(location, id, name, type, tags) + { + Identity = identity; + Kind = kind; + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service identity associated with a resource. + /// + [JsonProperty(PropertyName = "identity")] + public ResourceIdentity Identity { get; set; } + + /// + /// Gets or sets metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public BatchDeployment Properties { get; set; } + + /// + /// Gets system data associated with resource provider + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchEndpoint.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchEndpoint.cs new file mode 100644 index 000000000000..20410f412afe --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchEndpoint.cs @@ -0,0 +1,114 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Batch endpoint configuration. + /// + public partial class BatchEndpoint + { + /// + /// Initializes a new instance of the BatchEndpoint class. + /// + public BatchEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchEndpoint class. + /// + /// Enum to determine endpoint authentication + /// mode. Possible values include: 'AMLToken', 'Key', + /// 'AADToken' + /// Description of the inference + /// endpoint. + /// EndpointAuthKeys to set initially on an + /// Endpoint. + /// This property will always be returned as null. AuthKey values must + /// be retrieved using the ListKeys API. + /// Property dictionary. Properties can be + /// added, but not removed or altered. + /// Endpoint URI. + /// Endpoint Swagger URI. + /// Traffic rules on how the traffic will be + /// routed across deployments. + public BatchEndpoint(string authMode = default(string), string description = default(string), EndpointAuthKeys keys = default(EndpointAuthKeys), IDictionary properties = default(IDictionary), string scoringUri = default(string), string swaggerUri = default(string), IDictionary traffic = default(IDictionary)) + { + AuthMode = authMode; + Description = description; + Keys = keys; + Properties = properties; + ScoringUri = scoringUri; + SwaggerUri = swaggerUri; + Traffic = traffic; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets enum to determine endpoint authentication mode. + /// Possible values include: 'AMLToken', 'Key', 'AADToken' + /// + [JsonProperty(PropertyName = "authMode")] + public string AuthMode { get; set; } + + /// + /// Gets or sets description of the inference endpoint. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets endpointAuthKeys to set initially on an Endpoint. + /// This property will always be returned as null. AuthKey values must + /// be retrieved using the ListKeys API. + /// + [JsonProperty(PropertyName = "keys")] + public EndpointAuthKeys Keys { get; set; } + + /// + /// Gets or sets property dictionary. Properties can be added, but not + /// removed or altered. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets endpoint URI. + /// + [JsonProperty(PropertyName = "scoringUri")] + public string ScoringUri { get; private set; } + + /// + /// Gets endpoint Swagger URI. + /// + [JsonProperty(PropertyName = "swaggerUri")] + public string SwaggerUri { get; private set; } + + /// + /// Gets or sets traffic rules on how the traffic will be routed across + /// deployments. + /// + [JsonProperty(PropertyName = "traffic")] + public IDictionary Traffic { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchEndpointTrackedResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchEndpointTrackedResource.cs new file mode 100644 index 000000000000..7d42c5b3f212 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchEndpointTrackedResource.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class BatchEndpointTrackedResource : TrackedResource + { + /// + /// Initializes a new instance of the BatchEndpointTrackedResource + /// class. + /// + public BatchEndpointTrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchEndpointTrackedResource + /// class. + /// + /// The geo-location where the resource + /// lives + /// Additional attributes of the + /// entity. + /// 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" + /// Resource tags. + /// Service identity associated with a + /// resource. + /// Metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// System data associated with resource + /// provider + public BatchEndpointTrackedResource(string location, BatchEndpoint properties, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentity identity = default(ResourceIdentity), string kind = default(string), SystemData systemData = default(SystemData)) + : base(location, id, name, type, tags) + { + Identity = identity; + Kind = kind; + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service identity associated with a resource. + /// + [JsonProperty(PropertyName = "identity")] + public ResourceIdentity Identity { get; set; } + + /// + /// Gets or sets metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public BatchEndpoint Properties { get; set; } + + /// + /// Gets system data associated with resource provider + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchLoggingLevel.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchLoggingLevel.cs new file mode 100644 index 000000000000..29cd53c27015 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchLoggingLevel.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for BatchLoggingLevel. + /// + public static class BatchLoggingLevel + { + public const string Info = "Info"; + public const string Warning = "Warning"; + public const string Debug = "Debug"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchOutputAction.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchOutputAction.cs new file mode 100644 index 000000000000..e6c115312ee9 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchOutputAction.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for BatchOutputAction. + /// + public static class BatchOutputAction + { + public const string SummaryOnly = "SummaryOnly"; + public const string AppendRow = "AppendRow"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchOutputConfiguration.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchOutputConfiguration.cs new file mode 100644 index 000000000000..9d199290a0e8 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchOutputConfiguration.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Batch inference output configuration. + /// + public partial class BatchOutputConfiguration + { + /// + /// Initializes a new instance of the BatchOutputConfiguration class. + /// + public BatchOutputConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchOutputConfiguration class. + /// + /// Customized output file name for + /// append_row output action. + /// Indicates how the output will be + /// organized. Possible values include: 'SummaryOnly', + /// 'AppendRow' + public BatchOutputConfiguration(string appendRowFileName = default(string), string outputAction = default(string)) + { + AppendRowFileName = appendRowFileName; + OutputAction = outputAction; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets customized output file name for append_row output + /// action. + /// + [JsonProperty(PropertyName = "appendRowFileName")] + public string AppendRowFileName { get; set; } + + /// + /// Gets or sets indicates how the output will be organized. Possible + /// values include: 'SummaryOnly', 'AppendRow' + /// + [JsonProperty(PropertyName = "outputAction")] + public string OutputAction { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchRetrySettings.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchRetrySettings.cs new file mode 100644 index 000000000000..4b0c20e22c05 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/BatchRetrySettings.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Retry settings for a batch inference operation. + /// + public partial class BatchRetrySettings + { + /// + /// Initializes a new instance of the BatchRetrySettings class. + /// + public BatchRetrySettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchRetrySettings class. + /// + /// Maximum retry count for a + /// mini-batch + /// Invocation timeout for a mini-batch, in ISO + /// 8601 format. + public BatchRetrySettings(int? maxRetries = default(int?), System.TimeSpan? timeout = default(System.TimeSpan?)) + { + MaxRetries = maxRetries; + Timeout = timeout; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets maximum retry count for a mini-batch + /// + [JsonProperty(PropertyName = "maxRetries")] + public int? MaxRetries { get; set; } + + /// + /// Gets or sets invocation timeout for a mini-batch, in ISO 8601 + /// format. + /// + [JsonProperty(PropertyName = "timeout")] + public System.TimeSpan? Timeout { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CertificateDatastoreCredentials.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CertificateDatastoreCredentials.cs new file mode 100644 index 000000000000..251b523fcea9 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CertificateDatastoreCredentials.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Certificate datastore credentials configuration. + /// + [Newtonsoft.Json.JsonObject("Certificate")] + public partial class CertificateDatastoreCredentials : DatastoreCredentials + { + /// + /// Initializes a new instance of the CertificateDatastoreCredentials + /// class. + /// + public CertificateDatastoreCredentials() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateDatastoreCredentials + /// class. + /// + /// Service principal client ID. + /// ID of the tenant to which the service + /// principal belongs. + /// Thumbprint of the certificate used for + /// authentication. + /// Authority URL used for + /// authentication. + /// Resource the service principal has access + /// to. + /// Service principal secrets. + public CertificateDatastoreCredentials(System.Guid clientId, System.Guid tenantId, string thumbprint, string authorityUrl = default(string), string resourceUri = default(string), CertificateDatastoreSecrets secrets = default(CertificateDatastoreSecrets)) + { + AuthorityUrl = authorityUrl; + ClientId = clientId; + ResourceUri = resourceUri; + Secrets = secrets; + TenantId = tenantId; + Thumbprint = thumbprint; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets authority URL used for authentication. + /// + [JsonProperty(PropertyName = "authorityUrl")] + public string AuthorityUrl { get; set; } + + /// + /// Gets or sets service principal client ID. + /// + [JsonProperty(PropertyName = "clientId")] + public System.Guid ClientId { get; set; } + + /// + /// Gets or sets resource the service principal has access to. + /// + [JsonProperty(PropertyName = "resourceUri")] + public string ResourceUri { get; set; } + + /// + /// Gets or sets service principal secrets. + /// + [JsonProperty(PropertyName = "secrets")] + public CertificateDatastoreSecrets Secrets { get; set; } + + /// + /// Gets or sets ID of the tenant to which the service principal + /// belongs. + /// + [JsonProperty(PropertyName = "tenantId")] + public System.Guid TenantId { get; set; } + + /// + /// Gets or sets thumbprint of the certificate used for authentication. + /// + [JsonProperty(PropertyName = "thumbprint")] + public string Thumbprint { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Thumbprint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Thumbprint"); + } + if (Thumbprint != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Thumbprint, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Thumbprint", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CertificateDatastoreSecrets.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CertificateDatastoreSecrets.cs new file mode 100644 index 000000000000..18cb935dadf1 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CertificateDatastoreSecrets.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Datastore certificate secrets. + /// + [Newtonsoft.Json.JsonObject("Certificate")] + public partial class CertificateDatastoreSecrets : DatastoreSecrets + { + /// + /// Initializes a new instance of the CertificateDatastoreSecrets + /// class. + /// + public CertificateDatastoreSecrets() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateDatastoreSecrets + /// class. + /// + /// Service principal certificate. + public CertificateDatastoreSecrets(string certificate = default(string)) + { + Certificate = certificate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service principal certificate. + /// + [JsonProperty(PropertyName = "certificate")] + public string Certificate { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ClusterPurpose.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ClusterPurpose.cs new file mode 100644 index 000000000000..8dab7387b2ee --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ClusterPurpose.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ClusterPurpose. + /// + public static class ClusterPurpose + { + public const string FastProd = "FastProd"; + public const string DenseProd = "DenseProd"; + public const string DevTest = "DevTest"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ClusterUpdateParameters.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ClusterUpdateParameters.cs new file mode 100644 index 000000000000..9087828997a0 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ClusterUpdateParameters.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// AmlCompute update parameters. + /// + [Rest.Serialization.JsonTransformation] + public partial class ClusterUpdateParameters + { + /// + /// Initializes a new instance of the ClusterUpdateParameters class. + /// + public ClusterUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ClusterUpdateParameters class. + /// + /// Scale settings. + public ClusterUpdateParameters(ScaleSettings scaleSettings = default(ScaleSettings)) + { + ScaleSettings = scaleSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets scale settings. + /// + /// + /// Desired scale settings for the amlCompute. + /// + [JsonProperty(PropertyName = "properties.scaleSettings")] + public ScaleSettings ScaleSettings { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ScaleSettings != null) + { + ScaleSettings.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CocoExportSummary.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CocoExportSummary.cs new file mode 100644 index 000000000000..b33bca028281 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CocoExportSummary.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + [Newtonsoft.Json.JsonObject("Coco")] + public partial class CocoExportSummary : ExportSummary + { + /// + /// Initializes a new instance of the CocoExportSummary class. + /// + public CocoExportSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CocoExportSummary class. + /// + /// The time when the export was + /// completed. + /// The total number of labeled + /// datapoints exported. + /// Name and identifier of the job + /// containing exported labels. + /// The time when the export was + /// requested. + /// The container name to which the labels + /// will be exported. + /// The output path where the labels will be + /// exported. + public CocoExportSummary(System.DateTime? endTimeUtc = default(System.DateTime?), long? exportedRowCount = default(long?), string labelingJobId = default(string), System.DateTime? startTimeUtc = default(System.DateTime?), string containerName = default(string), string snapshotPath = default(string)) + : base(endTimeUtc, exportedRowCount, labelingJobId, startTimeUtc) + { + ContainerName = containerName; + SnapshotPath = snapshotPath; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the container name to which the labels will be exported. + /// + [JsonProperty(PropertyName = "containerName")] + public string ContainerName { get; private set; } + + /// + /// Gets the output path where the labels will be exported. + /// + [JsonProperty(PropertyName = "snapshotPath")] + public string SnapshotPath { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CodeConfiguration.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CodeConfiguration.cs new file mode 100644 index 000000000000..2cf00d39eaf4 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CodeConfiguration.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Configuration for a scoring code asset. + /// + public partial class CodeConfiguration + { + /// + /// Initializes a new instance of the CodeConfiguration class. + /// + public CodeConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CodeConfiguration class. + /// + /// The script to execute on startup. eg. + /// "score.py" + /// ARM resource ID of the code asset. + public CodeConfiguration(string scoringScript, string codeId = default(string)) + { + CodeId = codeId; + ScoringScript = scoringScript; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ARM resource ID of the code asset. + /// + [JsonProperty(PropertyName = "codeId")] + public string CodeId { get; set; } + + /// + /// Gets or sets the script to execute on startup. eg. "score.py" + /// + [JsonProperty(PropertyName = "scoringScript")] + public string ScoringScript { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ScoringScript == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ScoringScript"); + } + if (ScoringScript != null) + { + if (ScoringScript.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ScoringScript", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(ScoringScript, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "ScoringScript", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CodeContainer.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CodeContainer.cs new file mode 100644 index 000000000000..e1b7ae2679a4 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CodeContainer.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Container for code asset versions. + /// + public partial class CodeContainer + { + /// + /// Initializes a new instance of the CodeContainer class. + /// + public CodeContainer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CodeContainer class. + /// + /// The asset description text. + /// The asset property dictionary. + /// Tag dictionary. Tags can be added, removed, and + /// updated. + public CodeContainer(string description = default(string), IDictionary properties = default(IDictionary), IDictionary tags = default(IDictionary)) + { + Description = description; + Properties = properties; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the asset description text. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the asset property dictionary. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets or sets tag dictionary. Tags can be added, removed, and + /// updated. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CodeContainerResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CodeContainerResource.cs new file mode 100644 index 000000000000..0456bb4f9310 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CodeContainerResource.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Resource Manager resource envelope. + /// + public partial class CodeContainerResource : Resource + { + /// + /// Initializes a new instance of the CodeContainerResource class. + /// + public CodeContainerResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CodeContainerResource class. + /// + /// Additional attributes of the + /// entity. + /// 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" + /// System data associated with resource + /// provider + public CodeContainerResource(CodeContainer properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public CodeContainer Properties { get; set; } + + /// + /// Gets system data associated with resource provider + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CodeVersion.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CodeVersion.cs new file mode 100644 index 000000000000..4f1df90e28eb --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CodeVersion.cs @@ -0,0 +1,121 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Code asset version details. + /// + public partial class CodeVersion + { + /// + /// Initializes a new instance of the CodeVersion class. + /// + public CodeVersion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CodeVersion class. + /// + /// The path of the file/directory in the + /// datastore. + /// ARM resource ID of the datastore where + /// the asset is located. + /// The asset description text. + /// If the name version are system generated + /// (anonymous registration). + /// The asset property dictionary. + /// Tag dictionary. Tags can be added, removed, and + /// updated. + public CodeVersion(string path, string datastoreId = default(string), string description = default(string), bool? isAnonymous = default(bool?), IDictionary properties = default(IDictionary), IDictionary tags = default(IDictionary)) + { + DatastoreId = datastoreId; + Description = description; + IsAnonymous = isAnonymous; + Path = path; + Properties = properties; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ARM resource ID of the datastore where the asset is + /// located. + /// + [JsonProperty(PropertyName = "datastoreId")] + public string DatastoreId { get; set; } + + /// + /// Gets or sets the asset description text. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets if the name version are system generated (anonymous + /// registration). + /// + [JsonProperty(PropertyName = "isAnonymous")] + public bool? IsAnonymous { get; set; } + + /// + /// Gets or sets the path of the file/directory in the datastore. + /// + [JsonProperty(PropertyName = "path")] + public string Path { get; set; } + + /// + /// Gets or sets the asset property dictionary. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets or sets tag dictionary. Tags can be added, removed, and + /// updated. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Path == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Path"); + } + if (Path != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Path, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Path", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CodeVersionResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CodeVersionResource.cs new file mode 100644 index 000000000000..6ef3a9ab0189 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CodeVersionResource.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Resource Manager resource envelope. + /// + public partial class CodeVersionResource : Resource + { + /// + /// Initializes a new instance of the CodeVersionResource class. + /// + public CodeVersionResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CodeVersionResource class. + /// + /// Additional attributes of the + /// entity. + /// 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" + /// System data associated with resource + /// provider + public CodeVersionResource(CodeVersion properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public CodeVersion Properties { get; set; } + + /// + /// Gets system data associated with resource provider + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CommandJob.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CommandJob.cs new file mode 100644 index 000000000000..a126ac7738bd --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CommandJob.cs @@ -0,0 +1,240 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Command job definition. + /// + [Newtonsoft.Json.JsonObject("Command")] + public partial class CommandJob : JobBase + { + /// + /// Initializes a new instance of the CommandJob class. + /// + public CommandJob() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CommandJob class. + /// + /// The command to execute on startup of the job. + /// eg. "python train.py" + /// Compute binding for the job. + /// The asset description text. + /// List of JobEndpoints. + /// For local jobs, a job endpoint will have an endpoint value of + /// FileStreamObject. + /// The asset property dictionary. + /// Specifies the job provisioning + /// state. Possible values include: 'Succeeded', 'Failed', 'Canceled', + /// 'InProgress' + /// Tag dictionary. Tags can be added, removed, and + /// updated. + /// ARM resource ID of the code asset. + /// Distribution configuration of the job. + /// If set, this should be one of Mpi, Tensorflow, PyTorch, or + /// null. + /// The ARM resource ID of the Environment + /// specification for the job. + /// Environment variables included + /// in the job. + /// The name of the experiment the job + /// belongs to. If not set, the job is placed in the "Default" + /// experiment. + /// Identity configuration. If set, this should + /// be one of AmlToken, ManagedIdentity, or null. + /// Defaults to AmlToken if null. + /// Mapping of input data bindings used + /// in the job. + /// Location of the job output logs and + /// artifacts. + /// Mapping of output data bindings + /// used in the job. + /// Input parameters. + /// Job priority for scheduling policy. Only + /// applies to AMLCompute. + /// Private preview feature and only available to users on the allow + /// list. + /// Status of the job. Possible values include: + /// 'NotStarted', 'Starting', 'Provisioning', 'Preparing', 'Queued', + /// 'Running', 'Finalizing', 'CancelRequested', 'Completed', 'Failed', + /// 'Canceled', 'NotResponding', 'Paused', 'Unknown' + /// The max run duration in ISO 8601 format, + /// after which the job will be cancelled. Only supports duration with + /// precision as low as Seconds. + public CommandJob(string command, ComputeConfiguration compute, string description = default(string), IDictionary interactionEndpoints = default(IDictionary), IDictionary properties = default(IDictionary), string provisioningState = default(string), IDictionary tags = default(IDictionary), string codeId = default(string), DistributionConfiguration distribution = default(DistributionConfiguration), string environmentId = default(string), IDictionary environmentVariables = default(IDictionary), string experimentName = default(string), IdentityConfiguration identity = default(IdentityConfiguration), IDictionary inputDataBindings = default(IDictionary), JobOutput output = default(JobOutput), IDictionary outputDataBindings = default(IDictionary), IDictionary parameters = default(IDictionary), int? priority = default(int?), string status = default(string), System.TimeSpan? timeout = default(System.TimeSpan?)) + : base(description, interactionEndpoints, properties, provisioningState, tags) + { + CodeId = codeId; + Command = command; + Compute = compute; + Distribution = distribution; + EnvironmentId = environmentId; + EnvironmentVariables = environmentVariables; + ExperimentName = experimentName; + Identity = identity; + InputDataBindings = inputDataBindings; + Output = output; + OutputDataBindings = outputDataBindings; + Parameters = parameters; + Priority = priority; + Status = status; + Timeout = timeout; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ARM resource ID of the code asset. + /// + [JsonProperty(PropertyName = "codeId")] + public string CodeId { get; set; } + + /// + /// Gets or sets the command to execute on startup of the job. eg. + /// "python train.py" + /// + [JsonProperty(PropertyName = "command")] + public string Command { get; set; } + + /// + /// Gets or sets compute binding for the job. + /// + [JsonProperty(PropertyName = "compute")] + public ComputeConfiguration Compute { get; set; } + + /// + /// Gets or sets distribution configuration of the job. If set, this + /// should be one of Mpi, Tensorflow, PyTorch, or null. + /// + [JsonProperty(PropertyName = "distribution")] + public DistributionConfiguration Distribution { get; set; } + + /// + /// Gets or sets the ARM resource ID of the Environment specification + /// for the job. + /// + [JsonProperty(PropertyName = "environmentId")] + public string EnvironmentId { get; set; } + + /// + /// Gets or sets environment variables included in the job. + /// + [JsonProperty(PropertyName = "environmentVariables")] + public IDictionary EnvironmentVariables { get; set; } + + /// + /// Gets or sets the name of the experiment the job belongs to. If not + /// set, the job is placed in the "Default" experiment. + /// + [JsonProperty(PropertyName = "experimentName")] + public string ExperimentName { get; set; } + + /// + /// Gets or sets identity configuration. If set, this should be one of + /// AmlToken, ManagedIdentity, or null. + /// Defaults to AmlToken if null. + /// + [JsonProperty(PropertyName = "identity")] + public IdentityConfiguration Identity { get; set; } + + /// + /// Gets or sets mapping of input data bindings used in the job. + /// + [JsonProperty(PropertyName = "inputDataBindings")] + public IDictionary InputDataBindings { get; set; } + + /// + /// Gets location of the job output logs and artifacts. + /// + [JsonProperty(PropertyName = "output")] + public JobOutput Output { get; private set; } + + /// + /// Gets or sets mapping of output data bindings used in the job. + /// + [JsonProperty(PropertyName = "outputDataBindings")] + public IDictionary OutputDataBindings { get; set; } + + /// + /// Gets input parameters. + /// + [JsonProperty(PropertyName = "parameters")] + public IDictionary Parameters { get; private set; } + + /// + /// Gets or sets job priority for scheduling policy. Only applies to + /// AMLCompute. + /// Private preview feature and only available to users on the allow + /// list. + /// + [JsonProperty(PropertyName = "priority")] + public int? Priority { get; set; } + + /// + /// Gets status of the job. Possible values include: 'NotStarted', + /// 'Starting', 'Provisioning', 'Preparing', 'Queued', 'Running', + /// 'Finalizing', 'CancelRequested', 'Completed', 'Failed', 'Canceled', + /// 'NotResponding', 'Paused', 'Unknown' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets or sets the max run duration in ISO 8601 format, after which + /// the job will be cancelled. Only supports duration with precision as + /// low as Seconds. + /// + [JsonProperty(PropertyName = "timeout")] + public System.TimeSpan? Timeout { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Command == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Command"); + } + if (Compute == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Compute"); + } + if (Command != null) + { + if (Command.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Command", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(Command, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Command", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Compute.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Compute.cs new file mode 100644 index 000000000000..4f8889bbda61 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Compute.cs @@ -0,0 +1,135 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Machine Learning compute object. + /// + public partial class Compute + { + /// + /// Initializes a new instance of the Compute class. + /// + public Compute() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Compute class. + /// + /// Location for the underlying + /// compute + /// The provision state of the cluster. + /// Valid values are Unknown, Updating, Provisioning, Succeeded, and + /// Failed. Possible values include: 'Unknown', 'Updating', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// The description of the Machine Learning + /// compute. + /// The time at which the compute was + /// created. + /// The time at which the compute was last + /// modified. + /// ARM resource id of the underlying + /// compute + /// Errors during provisioning + /// Indicating whether the compute was + /// provisioned by user and brought from outside if true, or machine + /// learning service provisioned it if false. + /// Opt-out of local authentication and + /// ensure customers can use only MSI and AAD exclusively for + /// authentication. + public Compute(string computeLocation = default(string), string provisioningState = default(string), string description = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? modifiedOn = default(System.DateTime?), string resourceId = default(string), IList provisioningErrors = default(IList), bool? isAttachedCompute = default(bool?), bool? disableLocalAuth = default(bool?)) + { + ComputeLocation = computeLocation; + ProvisioningState = provisioningState; + Description = description; + CreatedOn = createdOn; + ModifiedOn = modifiedOn; + ResourceId = resourceId; + ProvisioningErrors = provisioningErrors; + IsAttachedCompute = isAttachedCompute; + DisableLocalAuth = disableLocalAuth; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets location for the underlying compute + /// + [JsonProperty(PropertyName = "computeLocation")] + public string ComputeLocation { get; set; } + + /// + /// Gets the provision state of the cluster. Valid values are Unknown, + /// Updating, Provisioning, Succeeded, and Failed. Possible values + /// include: 'Unknown', 'Updating', 'Creating', 'Deleting', + /// 'Succeeded', 'Failed', 'Canceled' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the description of the Machine Learning compute. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets the time at which the compute was created. + /// + [JsonProperty(PropertyName = "createdOn")] + public System.DateTime? CreatedOn { get; private set; } + + /// + /// Gets the time at which the compute was last modified. + /// + [JsonProperty(PropertyName = "modifiedOn")] + public System.DateTime? ModifiedOn { get; private set; } + + /// + /// Gets or sets ARM resource id of the underlying compute + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets errors during provisioning + /// + [JsonProperty(PropertyName = "provisioningErrors")] + public IList ProvisioningErrors { get; private set; } + + /// + /// Gets indicating whether the compute was provisioned by user and + /// brought from outside if true, or machine learning service + /// provisioned it if false. + /// + [JsonProperty(PropertyName = "isAttachedCompute")] + public bool? IsAttachedCompute { get; private set; } + + /// + /// Gets or sets opt-out of local authentication and ensure customers + /// can use only MSI and AAD exclusively for authentication. + /// + [JsonProperty(PropertyName = "disableLocalAuth")] + public bool? DisableLocalAuth { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeConfiguration.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeConfiguration.cs new file mode 100644 index 000000000000..a48892ece5da --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeConfiguration.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Configuration for compute binding. + /// + public partial class ComputeConfiguration + { + /// + /// Initializes a new instance of the ComputeConfiguration class. + /// + public ComputeConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeConfiguration class. + /// + /// Number of instances or nodes. + /// SKU type to run on. + /// Set to true for jobs running on local + /// compute. + /// Location for virtual cluster run. + /// Additional properties. + /// ARM resource ID of the compute + /// resource. + public ComputeConfiguration(int? instanceCount = default(int?), string instanceType = default(string), bool? isLocal = default(bool?), string location = default(string), IDictionary properties = default(IDictionary), string target = default(string)) + { + InstanceCount = instanceCount; + InstanceType = instanceType; + IsLocal = isLocal; + Location = location; + Properties = properties; + Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets number of instances or nodes. + /// + [JsonProperty(PropertyName = "instanceCount")] + public int? InstanceCount { get; set; } + + /// + /// Gets or sets SKU type to run on. + /// + [JsonProperty(PropertyName = "instanceType")] + public string InstanceType { get; set; } + + /// + /// Gets or sets set to true for jobs running on local compute. + /// + [JsonProperty(PropertyName = "isLocal")] + public bool? IsLocal { get; set; } + + /// + /// Gets or sets location for virtual cluster run. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets additional properties. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets or sets ARM resource ID of the compute resource. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeCreateOrUpdateHeaders.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeCreateOrUpdateHeaders.cs new file mode 100644 index 000000000000..390e295e7831 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeCreateOrUpdateHeaders.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for CreateOrUpdate operation. + /// + public partial class ComputeCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the ComputeCreateOrUpdateHeaders + /// class. + /// + public ComputeCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeCreateOrUpdateHeaders + /// class. + /// + /// URI to poll for asynchronous + /// operation status. + public ComputeCreateOrUpdateHeaders(string azureAsyncOperation = default(string)) + { + AzureAsyncOperation = azureAsyncOperation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URI to poll for asynchronous operation status. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeDeleteHeaders.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeDeleteHeaders.cs new file mode 100644 index 000000000000..fa7552351c04 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeDeleteHeaders.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class ComputeDeleteHeaders + { + /// + /// Initializes a new instance of the ComputeDeleteHeaders class. + /// + public ComputeDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeDeleteHeaders class. + /// + /// URI to poll for asynchronous + /// operation status. + /// URI to poll for asynchronous operation + /// result. + public ComputeDeleteHeaders(string azureAsyncOperation = default(string), string location = default(string)) + { + AzureAsyncOperation = azureAsyncOperation; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URI to poll for asynchronous operation status. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets URI to poll for asynchronous operation result. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstance.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstance.cs new file mode 100644 index 000000000000..7440f7cbdbc7 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstance.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Azure Machine Learning compute instance. + /// + public partial class ComputeInstance : Compute + { + /// + /// Initializes a new instance of the ComputeInstance class. + /// + public ComputeInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeInstance class. + /// + /// Location for the underlying + /// compute + /// The provision state of the cluster. + /// Valid values are Unknown, Updating, Provisioning, Succeeded, and + /// Failed. Possible values include: 'Unknown', 'Updating', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// The description of the Machine Learning + /// compute. + /// The time at which the compute was + /// created. + /// The time at which the compute was last + /// modified. + /// ARM resource id of the underlying + /// compute + /// Errors during provisioning + /// Indicating whether the compute was + /// provisioned by user and brought from outside if true, or machine + /// learning service provisioned it if false. + /// Opt-out of local authentication and + /// ensure customers can use only MSI and AAD exclusively for + /// authentication. + /// Compute Instance properties + public ComputeInstance(string computeLocation = default(string), string provisioningState = default(string), string description = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? modifiedOn = default(System.DateTime?), string resourceId = default(string), IList provisioningErrors = default(IList), bool? isAttachedCompute = default(bool?), bool? disableLocalAuth = default(bool?), ComputeInstanceProperties properties = default(ComputeInstanceProperties)) + : base(computeLocation, provisioningState, description, createdOn, modifiedOn, resourceId, provisioningErrors, isAttachedCompute, disableLocalAuth) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets compute Instance properties + /// + [JsonProperty(PropertyName = "properties")] + public ComputeInstanceProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceApplication.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceApplication.cs new file mode 100644 index 000000000000..be3364ccba8f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceApplication.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines an Aml Instance application and its connectivity endpoint URI. + /// + public partial class ComputeInstanceApplication + { + /// + /// Initializes a new instance of the ComputeInstanceApplication class. + /// + public ComputeInstanceApplication() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeInstanceApplication class. + /// + /// Name of the ComputeInstance + /// application. + /// Application' endpoint URI. + public ComputeInstanceApplication(string displayName = default(string), string endpointUri = default(string)) + { + DisplayName = displayName; + EndpointUri = endpointUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the ComputeInstance application. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets application' endpoint URI. + /// + [JsonProperty(PropertyName = "endpointUri")] + public string EndpointUri { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceAuthorizationType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceAuthorizationType.cs new file mode 100644 index 000000000000..550278a3bf0e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceAuthorizationType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ComputeInstanceAuthorizationType. + /// + public static class ComputeInstanceAuthorizationType + { + public const string Personal = "personal"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceConnectivityEndpoints.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceConnectivityEndpoints.cs new file mode 100644 index 000000000000..583e2186462e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceConnectivityEndpoints.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines all connectivity endpoints and properties for an + /// ComputeInstance. + /// + public partial class ComputeInstanceConnectivityEndpoints + { + /// + /// Initializes a new instance of the + /// ComputeInstanceConnectivityEndpoints class. + /// + public ComputeInstanceConnectivityEndpoints() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ComputeInstanceConnectivityEndpoints class. + /// + /// Public IP Address of this + /// ComputeInstance. + /// Private IP Address of this + /// ComputeInstance (local to the VNET in which the compute instance is + /// deployed). + public ComputeInstanceConnectivityEndpoints(string publicIpAddress = default(string), string privateIpAddress = default(string)) + { + PublicIpAddress = publicIpAddress; + PrivateIpAddress = privateIpAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets public IP Address of this ComputeInstance. + /// + [JsonProperty(PropertyName = "publicIpAddress")] + public string PublicIpAddress { get; private set; } + + /// + /// Gets private IP Address of this ComputeInstance (local to the VNET + /// in which the compute instance is deployed). + /// + [JsonProperty(PropertyName = "privateIpAddress")] + public string PrivateIpAddress { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceCreatedBy.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceCreatedBy.cs new file mode 100644 index 000000000000..859860ea27d6 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceCreatedBy.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes information on user who created this ComputeInstance. + /// + public partial class ComputeInstanceCreatedBy + { + /// + /// Initializes a new instance of the ComputeInstanceCreatedBy class. + /// + public ComputeInstanceCreatedBy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeInstanceCreatedBy class. + /// + /// Name of the user. + /// Uniquely identifies user' Azure Active + /// Directory organization. + /// Uniquely identifies the user within his/her + /// organization. + public ComputeInstanceCreatedBy(string userName = default(string), string userOrgId = default(string), string userId = default(string)) + { + UserName = userName; + UserOrgId = userOrgId; + UserId = userId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets name of the user. + /// + [JsonProperty(PropertyName = "userName")] + public string UserName { get; private set; } + + /// + /// Gets uniquely identifies user' Azure Active Directory organization. + /// + [JsonProperty(PropertyName = "userOrgId")] + public string UserOrgId { get; private set; } + + /// + /// Gets uniquely identifies the user within his/her organization. + /// + [JsonProperty(PropertyName = "userId")] + public string UserId { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceLastOperation.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceLastOperation.cs new file mode 100644 index 000000000000..451934129a22 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceLastOperation.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The last operation on ComputeInstance. + /// + public partial class ComputeInstanceLastOperation + { + /// + /// Initializes a new instance of the ComputeInstanceLastOperation + /// class. + /// + public ComputeInstanceLastOperation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeInstanceLastOperation + /// class. + /// + /// Name of the last operation. Possible + /// values include: 'Create', 'Start', 'Stop', 'Restart', 'Reimage', + /// 'Delete' + /// Time of the last operation. + /// Operation status. Possible values + /// include: 'InProgress', 'Succeeded', 'CreateFailed', 'StartFailed', + /// 'StopFailed', 'RestartFailed', 'ReimageFailed', + /// 'DeleteFailed' + public ComputeInstanceLastOperation(string operationName = default(string), System.DateTime? operationTime = default(System.DateTime?), string operationStatus = default(string)) + { + OperationName = operationName; + OperationTime = operationTime; + OperationStatus = operationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the last operation. Possible values include: + /// 'Create', 'Start', 'Stop', 'Restart', 'Reimage', 'Delete' + /// + [JsonProperty(PropertyName = "operationName")] + public string OperationName { get; set; } + + /// + /// Gets or sets time of the last operation. + /// + [JsonProperty(PropertyName = "operationTime")] + public System.DateTime? OperationTime { get; set; } + + /// + /// Gets or sets operation status. Possible values include: + /// 'InProgress', 'Succeeded', 'CreateFailed', 'StartFailed', + /// 'StopFailed', 'RestartFailed', 'ReimageFailed', 'DeleteFailed' + /// + [JsonProperty(PropertyName = "operationStatus")] + public string OperationStatus { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceProperties.cs new file mode 100644 index 000000000000..d7a5bed16115 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceProperties.cs @@ -0,0 +1,218 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Compute Instance properties + /// + public partial class ComputeInstanceProperties + { + /// + /// Initializes a new instance of the ComputeInstanceProperties class. + /// + public ComputeInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeInstanceProperties class. + /// + /// Virtual Machine Size + /// Subnet. + /// Sharing policy for + /// applications on this compute instance + /// Specifies policy and settings for SSH + /// access. + /// Describes all connectivity + /// endpoints available for this ComputeInstance. + /// Describes available applications and + /// their endpoints on this ComputeInstance. + /// Describes information on user who created + /// this ComputeInstance. + /// Errors. + /// The current state of this ComputeInstance. + /// Possible values include: 'Creating', 'CreateFailed', 'Deleting', + /// 'Running', 'Restarting', 'JobRunning', 'SettingUp', 'SetupFailed', + /// 'Starting', 'Stopped', 'Stopping', 'UserSettingUp', + /// 'UserSetupFailed', 'Unknown', 'Unusable' + /// Compute Instance + /// Authorization type. + /// Personal Compute + /// Instance settings. + /// Details of customized scripts to execute + /// for setting up the cluster. + /// The last operation on + /// ComputeInstance. + /// The list of schedules to be applied on the + /// compute instance. + public ComputeInstanceProperties(string vmSize = default(string), ResourceId subnet = default(ResourceId), string applicationSharingPolicy = default(string), ComputeInstanceSshSettings sshSettings = default(ComputeInstanceSshSettings), ComputeInstanceConnectivityEndpoints connectivityEndpoints = default(ComputeInstanceConnectivityEndpoints), IList applications = default(IList), ComputeInstanceCreatedBy createdBy = default(ComputeInstanceCreatedBy), IList errors = default(IList), string state = default(string), string computeInstanceAuthorizationType = default(string), PersonalComputeInstanceSettings personalComputeInstanceSettings = default(PersonalComputeInstanceSettings), SetupScripts setupScripts = default(SetupScripts), ComputeInstanceLastOperation lastOperation = default(ComputeInstanceLastOperation), ComputeSchedules schedules = default(ComputeSchedules)) + { + VmSize = vmSize; + Subnet = subnet; + ApplicationSharingPolicy = applicationSharingPolicy; + SshSettings = sshSettings; + ConnectivityEndpoints = connectivityEndpoints; + Applications = applications; + CreatedBy = createdBy; + Errors = errors; + State = state; + ComputeInstanceAuthorizationType = computeInstanceAuthorizationType; + PersonalComputeInstanceSettings = personalComputeInstanceSettings; + SetupScripts = setupScripts; + LastOperation = lastOperation; + Schedules = schedules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets virtual Machine Size + /// + [JsonProperty(PropertyName = "vmSize")] + public string VmSize { get; set; } + + /// + /// Gets or sets subnet. + /// + /// + /// Virtual network subnet resource ID the compute nodes belong to. + /// + [JsonProperty(PropertyName = "subnet")] + public ResourceId Subnet { get; set; } + + /// + /// Gets or sets sharing policy for applications on this compute + /// instance + /// + /// + /// Policy for sharing applications on this compute instance among + /// users of parent workspace. If Personal, only the creator can access + /// applications on this compute instance. When Shared, any workspace + /// user can access applications on this instance depending on his/her + /// assigned role. Possible values include: 'Personal', 'Shared' + /// + [JsonProperty(PropertyName = "applicationSharingPolicy")] + public string ApplicationSharingPolicy { get; set; } + + /// + /// Gets or sets specifies policy and settings for SSH access. + /// + [JsonProperty(PropertyName = "sshSettings")] + public ComputeInstanceSshSettings SshSettings { get; set; } + + /// + /// Gets describes all connectivity endpoints available for this + /// ComputeInstance. + /// + [JsonProperty(PropertyName = "connectivityEndpoints")] + public ComputeInstanceConnectivityEndpoints ConnectivityEndpoints { get; private set; } + + /// + /// Gets describes available applications and their endpoints on this + /// ComputeInstance. + /// + [JsonProperty(PropertyName = "applications")] + public IList Applications { get; private set; } + + /// + /// Gets describes information on user who created this + /// ComputeInstance. + /// + [JsonProperty(PropertyName = "createdBy")] + public ComputeInstanceCreatedBy CreatedBy { get; private set; } + + /// + /// Gets errors. + /// + /// + /// Collection of errors encountered on this ComputeInstance. + /// + [JsonProperty(PropertyName = "errors")] + public IList Errors { get; private set; } + + /// + /// Gets the current state of this ComputeInstance. Possible values + /// include: 'Creating', 'CreateFailed', 'Deleting', 'Running', + /// 'Restarting', 'JobRunning', 'SettingUp', 'SetupFailed', 'Starting', + /// 'Stopped', 'Stopping', 'UserSettingUp', 'UserSetupFailed', + /// 'Unknown', 'Unusable' + /// + [JsonProperty(PropertyName = "state")] + public string State { get; private set; } + + /// + /// Gets or sets compute Instance Authorization type. + /// + /// + /// The Compute Instance Authorization type. Available values are + /// personal (default). Possible values include: 'personal' + /// + [JsonProperty(PropertyName = "computeInstanceAuthorizationType")] + public string ComputeInstanceAuthorizationType { get; set; } + + /// + /// Gets or sets personal Compute Instance settings. + /// + /// + /// Settings for a personal compute instance. + /// + [JsonProperty(PropertyName = "personalComputeInstanceSettings")] + public PersonalComputeInstanceSettings PersonalComputeInstanceSettings { get; set; } + + /// + /// Gets or sets details of customized scripts to execute for setting + /// up the cluster. + /// + [JsonProperty(PropertyName = "setupScripts")] + public SetupScripts SetupScripts { get; set; } + + /// + /// Gets the last operation on ComputeInstance. + /// + [JsonProperty(PropertyName = "lastOperation")] + public ComputeInstanceLastOperation LastOperation { get; private set; } + + /// + /// Gets or sets the list of schedules to be applied on the compute + /// instance. + /// + [JsonProperty(PropertyName = "schedules")] + public ComputeSchedules Schedules { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Subnet != null) + { + Subnet.Validate(); + } + if (PersonalComputeInstanceSettings != null) + { + PersonalComputeInstanceSettings.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceSshSettings.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceSshSettings.cs new file mode 100644 index 000000000000..f09088648940 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceSshSettings.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies policy and settings for SSH access. + /// + public partial class ComputeInstanceSshSettings + { + /// + /// Initializes a new instance of the ComputeInstanceSshSettings class. + /// + public ComputeInstanceSshSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeInstanceSshSettings class. + /// + /// Access policy for SSH + /// Describes the admin user name. + /// Describes the port for connecting through + /// SSH. + /// Specifies the SSH rsa public key file + /// as a string. Use "ssh-keygen -t rsa -b 2048" to generate your SSH + /// key pairs. + public ComputeInstanceSshSettings(string sshPublicAccess = default(string), string adminUserName = default(string), int? sshPort = default(int?), string adminPublicKey = default(string)) + { + SshPublicAccess = sshPublicAccess; + AdminUserName = adminUserName; + SshPort = sshPort; + AdminPublicKey = adminPublicKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets access policy for SSH + /// + /// + /// State of the public SSH port. Possible values are: Disabled - + /// Indicates that the public ssh port is closed on this instance. + /// Enabled - Indicates that the public ssh port is open and accessible + /// according to the VNet/subnet policy if applicable. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "sshPublicAccess")] + public string SshPublicAccess { get; set; } + + /// + /// Gets describes the admin user name. + /// + [JsonProperty(PropertyName = "adminUserName")] + public string AdminUserName { get; private set; } + + /// + /// Gets describes the port for connecting through SSH. + /// + [JsonProperty(PropertyName = "sshPort")] + public int? SshPort { get; private set; } + + /// + /// Gets or sets specifies the SSH rsa public key file as a string. Use + /// "ssh-keygen -t rsa -b 2048" to generate your SSH key pairs. + /// + [JsonProperty(PropertyName = "adminPublicKey")] + public string AdminPublicKey { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceState.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceState.cs new file mode 100644 index 000000000000..fa0f95bdafb3 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeInstanceState.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ComputeInstanceState. + /// + public static class ComputeInstanceState + { + public const string Creating = "Creating"; + public const string CreateFailed = "CreateFailed"; + public const string Deleting = "Deleting"; + public const string Running = "Running"; + public const string Restarting = "Restarting"; + public const string JobRunning = "JobRunning"; + public const string SettingUp = "SettingUp"; + public const string SetupFailed = "SetupFailed"; + public const string Starting = "Starting"; + public const string Stopped = "Stopped"; + public const string Stopping = "Stopping"; + public const string UserSettingUp = "UserSettingUp"; + public const string UserSetupFailed = "UserSetupFailed"; + public const string Unknown = "Unknown"; + public const string Unusable = "Unusable"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeNodesInformation.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeNodesInformation.cs new file mode 100644 index 000000000000..f7e33347d2b9 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeNodesInformation.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Compute nodes information related to a Machine Learning compute. Might + /// differ for every type of compute. + /// + public partial class ComputeNodesInformation + { + /// + /// Initializes a new instance of the ComputeNodesInformation class. + /// + public ComputeNodesInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeNodesInformation class. + /// + /// The continuation token. + public ComputeNodesInformation(string nextLink = default(string)) + { + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the continuation token. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputePowerAction.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputePowerAction.cs new file mode 100644 index 000000000000..3e4c14d66fb2 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputePowerAction.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ComputePowerAction. + /// + public static class ComputePowerAction + { + public const string Start = "Start"; + public const string Stop = "Stop"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeResource.cs new file mode 100644 index 000000000000..6ed04f0950fa --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeResource.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Machine Learning compute object wrapped into ARM resource envelope. + /// + public partial class ComputeResource : Resource + { + /// + /// Initializes a new instance of the ComputeResource class. + /// + public ComputeResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeResource 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" + /// Compute properties + /// The identity of the resource. + /// Specifies the location of the + /// resource. + /// Contains resource tags defined as key/value + /// pairs. + /// The sku of the workspace. + public ComputeResource(string id = default(string), string name = default(string), string type = default(string), Compute properties = default(Compute), Identity identity = default(Identity), string location = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Properties = properties; + Identity = identity; + Location = location; + Tags = tags; + Sku = sku; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets compute properties + /// + [JsonProperty(PropertyName = "properties")] + public Compute Properties { get; set; } + + /// + /// Gets or sets the identity of the resource. + /// + [JsonProperty(PropertyName = "identity")] + public Identity Identity { get; set; } + + /// + /// Gets or sets specifies the location of the resource. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets contains resource tags defined as key/value pairs. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the sku of the workspace. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeSchedules.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeSchedules.cs new file mode 100644 index 000000000000..79cb1d9576b6 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeSchedules.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list of schedules to be applied on the computes + /// + public partial class ComputeSchedules + { + /// + /// Initializes a new instance of the ComputeSchedules class. + /// + public ComputeSchedules() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeSchedules class. + /// + /// The list of compute start stop + /// schedules to be applied. + public ComputeSchedules(IList computeStartStop = default(IList)) + { + ComputeStartStop = computeStartStop; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of compute start stop schedules to be + /// applied. + /// + [JsonProperty(PropertyName = "computeStartStop")] + public IList ComputeStartStop { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeSecrets.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeSecrets.cs new file mode 100644 index 000000000000..5c33a82a7a80 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeSecrets.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using System.Linq; + + /// + /// Secrets related to a Machine Learning compute. Might differ for every + /// type of compute. + /// + public partial class ComputeSecrets + { + /// + /// Initializes a new instance of the ComputeSecrets class. + /// + public ComputeSecrets() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeStartStopSchedule.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeStartStopSchedule.cs new file mode 100644 index 000000000000..8309b91476a4 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeStartStopSchedule.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Compute start stop schedule properties + /// + public partial class ComputeStartStopSchedule + { + /// + /// Initializes a new instance of the ComputeStartStopSchedule class. + /// + public ComputeStartStopSchedule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeStartStopSchedule class. + /// + /// Schedule id. + /// The current deployment state of + /// schedule. Possible values include: 'Completed', 'Provisioning', + /// 'Failed' + /// Possible values include: 'Enabled', + /// 'Disabled' + /// Possible values include: 'Recurrence', + /// 'Cron' + /// Possible values include: 'Start', + /// 'Stop' + public ComputeStartStopSchedule(string id = default(string), string provisioningStatus = default(string), string status = default(string), string triggerType = default(string), string action = default(string), Recurrence recurrence = default(Recurrence), Cron cron = default(Cron)) + { + Id = id; + ProvisioningStatus = provisioningStatus; + Status = status; + TriggerType = triggerType; + Action = action; + Recurrence = recurrence; + Cron = cron; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets schedule id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the current deployment state of schedule. Possible values + /// include: 'Completed', 'Provisioning', 'Failed' + /// + [JsonProperty(PropertyName = "provisioningStatus")] + public string ProvisioningStatus { get; private set; } + + /// + /// Gets or sets possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets possible values include: 'Recurrence', 'Cron' + /// + [JsonProperty(PropertyName = "triggerType")] + public string TriggerType { get; set; } + + /// + /// Gets or sets possible values include: 'Start', 'Stop' + /// + [JsonProperty(PropertyName = "action")] + public string Action { get; set; } + + /// + /// + [JsonProperty(PropertyName = "recurrence")] + public Recurrence Recurrence { get; set; } + + /// + /// + [JsonProperty(PropertyName = "cron")] + public Cron Cron { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeType.cs new file mode 100644 index 000000000000..3b374ccac1e4 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ComputeType.cs @@ -0,0 +1,29 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ComputeType. + /// + public static class ComputeType + { + public const string AKS = "AKS"; + public const string AmlCompute = "AmlCompute"; + public const string ComputeInstance = "ComputeInstance"; + public const string DataFactory = "DataFactory"; + public const string VirtualMachine = "VirtualMachine"; + public const string HDInsight = "HDInsight"; + public const string Databricks = "Databricks"; + public const string DataLakeAnalytics = "DataLakeAnalytics"; + public const string SynapseSpark = "SynapseSpark"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ContainerResourceRequirements.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ContainerResourceRequirements.cs new file mode 100644 index 000000000000..92356dd93ff0 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ContainerResourceRequirements.cs @@ -0,0 +1,111 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource requirements for the container (cpu and memory). + /// + public partial class ContainerResourceRequirements + { + /// + /// Initializes a new instance of the ContainerResourceRequirements + /// class. + /// + public ContainerResourceRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerResourceRequirements + /// class. + /// + /// The minimum amount of CPU cores to be used by the + /// container. More info: + /// https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + /// The maximum amount of CPU cores allowed to + /// be used by the container. More info: + /// https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + /// The minimum amount of memory (in GB) to be + /// used by the container. More info: + /// https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + /// The maximum amount of memory (in GB) + /// allowed to be used by the container. More info: + /// https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + /// The number of GPU cores in the container. + /// The number of FPGA PCIE devices exposed to the + /// container. Must be multiple of 2. + public ContainerResourceRequirements(double? cpu = default(double?), double? cpuLimit = default(double?), double? memoryInGB = default(double?), double? memoryInGBLimit = default(double?), int? gpu = default(int?), int? fpga = default(int?)) + { + Cpu = cpu; + CpuLimit = cpuLimit; + MemoryInGB = memoryInGB; + MemoryInGBLimit = memoryInGBLimit; + Gpu = gpu; + Fpga = fpga; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the minimum amount of CPU cores to be used by the + /// container. More info: + /// https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + /// + [JsonProperty(PropertyName = "cpu")] + public double? Cpu { get; set; } + + /// + /// Gets or sets the maximum amount of CPU cores allowed to be used by + /// the container. More info: + /// https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + /// + [JsonProperty(PropertyName = "cpuLimit")] + public double? CpuLimit { get; set; } + + /// + /// Gets or sets the minimum amount of memory (in GB) to be used by the + /// container. More info: + /// https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + /// + [JsonProperty(PropertyName = "memoryInGB")] + public double? MemoryInGB { get; set; } + + /// + /// Gets or sets the maximum amount of memory (in GB) allowed to be + /// used by the container. More info: + /// https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + /// + [JsonProperty(PropertyName = "memoryInGBLimit")] + public double? MemoryInGBLimit { get; set; } + + /// + /// Gets or sets the number of GPU cores in the container. + /// + [JsonProperty(PropertyName = "gpu")] + public int? Gpu { get; set; } + + /// + /// Gets or sets the number of FPGA PCIE devices exposed to the + /// container. Must be multiple of 2. + /// + [JsonProperty(PropertyName = "fpga")] + public int? Fpga { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ContainerType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ContainerType.cs new file mode 100644 index 000000000000..626101eeaeac --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ContainerType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ContainerType. + /// + public static class ContainerType + { + public const string StorageInitializer = "StorageInitializer"; + public const string InferenceServer = "InferenceServer"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ContentsType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ContentsType.cs new file mode 100644 index 000000000000..97a13cca8c58 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ContentsType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ContentsType. + /// + public static class ContentsType + { + public const string AzureBlob = "AzureBlob"; + public const string AzureDataLakeGen1 = "AzureDataLakeGen1"; + public const string AzureDataLakeGen2 = "AzureDataLakeGen2"; + public const string AzureFile = "AzureFile"; + public const string AzureMySql = "AzureMySql"; + public const string AzurePostgreSql = "AzurePostgreSql"; + public const string AzureSqlDatabase = "AzureSqlDatabase"; + public const string GlusterFs = "GlusterFs"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CosmosDbSettings.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CosmosDbSettings.cs new file mode 100644 index 000000000000..32b656c6b86d --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CosmosDbSettings.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class CosmosDbSettings + { + /// + /// Initializes a new instance of the CosmosDbSettings class. + /// + public CosmosDbSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CosmosDbSettings class. + /// + /// The throughput of the + /// collections in cosmosdb database + public CosmosDbSettings(int? collectionsThroughput = default(int?)) + { + CollectionsThroughput = collectionsThroughput; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the throughput of the collections in cosmosdb database + /// + [JsonProperty(PropertyName = "collectionsThroughput")] + public int? CollectionsThroughput { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CreatedByType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CreatedByType.cs new file mode 100644 index 000000000000..40cf9377dd8f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/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.Azure.Management.MachineLearningServices.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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CredentialsType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CredentialsType.cs new file mode 100644 index 000000000000..f408e928a07d --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CredentialsType.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for CredentialsType. + /// + public static class CredentialsType + { + public const string AccountKey = "AccountKey"; + public const string Certificate = "Certificate"; + public const string None = "None"; + public const string Sas = "Sas"; + public const string ServicePrincipal = "ServicePrincipal"; + public const string SqlAdmin = "SqlAdmin"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Cron.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Cron.cs new file mode 100644 index 000000000000..a954090fc216 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Cron.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The workflow trigger cron for ComputeStartStop schedule type. + /// + public partial class Cron + { + /// + /// Initializes a new instance of the Cron class. + /// + public Cron() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Cron class. + /// + /// The start time. + /// The time zone. + /// The cron expression. + public Cron(string startTime = default(string), string timeZone = default(string), string expression = default(string)) + { + StartTime = startTime; + TimeZone = timeZone; + Expression = expression; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the start time. + /// + [JsonProperty(PropertyName = "startTime")] + public string StartTime { get; set; } + + /// + /// Gets or sets the time zone. + /// + [JsonProperty(PropertyName = "timeZone")] + public string TimeZone { get; set; } + + /// + /// Gets or sets the cron expression. + /// + [JsonProperty(PropertyName = "expression")] + public string Expression { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CsvExportSummary.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CsvExportSummary.cs new file mode 100644 index 000000000000..25591e852b6f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/CsvExportSummary.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + [Newtonsoft.Json.JsonObject("CSV")] + public partial class CsvExportSummary : ExportSummary + { + /// + /// Initializes a new instance of the CsvExportSummary class. + /// + public CsvExportSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CsvExportSummary class. + /// + /// The time when the export was + /// completed. + /// The total number of labeled + /// datapoints exported. + /// Name and identifier of the job + /// containing exported labels. + /// The time when the export was + /// requested. + /// The container name to which the labels + /// will be exported. + /// The output path where the labels will be + /// exported. + public CsvExportSummary(System.DateTime? endTimeUtc = default(System.DateTime?), long? exportedRowCount = default(long?), string labelingJobId = default(string), System.DateTime? startTimeUtc = default(System.DateTime?), string containerName = default(string), string snapshotPath = default(string)) + : base(endTimeUtc, exportedRowCount, labelingJobId, startTimeUtc) + { + ContainerName = containerName; + SnapshotPath = snapshotPath; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the container name to which the labels will be exported. + /// + [JsonProperty(PropertyName = "containerName")] + public string ContainerName { get; private set; } + + /// + /// Gets the output path where the labels will be exported. + /// + [JsonProperty(PropertyName = "snapshotPath")] + public string SnapshotPath { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataBindingMode.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataBindingMode.cs new file mode 100644 index 000000000000..be851f98f588 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataBindingMode.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for DataBindingMode. + /// + public static class DataBindingMode + { + public const string Mount = "Mount"; + public const string Download = "Download"; + public const string Upload = "Upload"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataContainer.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataContainer.cs new file mode 100644 index 000000000000..bbc5ad62b177 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataContainer.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Container for data asset versions. + /// + public partial class DataContainer + { + /// + /// Initializes a new instance of the DataContainer class. + /// + public DataContainer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataContainer class. + /// + /// The asset description text. + /// The asset property dictionary. + /// Tag dictionary. Tags can be added, removed, and + /// updated. + public DataContainer(string description = default(string), IDictionary properties = default(IDictionary), IDictionary tags = default(IDictionary)) + { + Description = description; + Properties = properties; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the asset description text. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the asset property dictionary. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets or sets tag dictionary. Tags can be added, removed, and + /// updated. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataContainerResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataContainerResource.cs new file mode 100644 index 000000000000..5529d5c7a792 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataContainerResource.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Resource Manager resource envelope. + /// + public partial class DataContainerResource : Resource + { + /// + /// Initializes a new instance of the DataContainerResource class. + /// + public DataContainerResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataContainerResource class. + /// + /// Additional attributes of the + /// entity. + /// 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" + /// System data associated with resource + /// provider + public DataContainerResource(DataContainer properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public DataContainer Properties { get; set; } + + /// + /// Gets system data associated with resource provider + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataFactory.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataFactory.cs new file mode 100644 index 000000000000..972bfe1d0754 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataFactory.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.Azure.Management.MachineLearningServices.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A DataFactory compute. + /// + public partial class DataFactory : Compute + { + /// + /// Initializes a new instance of the DataFactory class. + /// + public DataFactory() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataFactory class. + /// + /// Location for the underlying + /// compute + /// The provision state of the cluster. + /// Valid values are Unknown, Updating, Provisioning, Succeeded, and + /// Failed. Possible values include: 'Unknown', 'Updating', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// The description of the Machine Learning + /// compute. + /// The time at which the compute was + /// created. + /// The time at which the compute was last + /// modified. + /// ARM resource id of the underlying + /// compute + /// Errors during provisioning + /// Indicating whether the compute was + /// provisioned by user and brought from outside if true, or machine + /// learning service provisioned it if false. + /// Opt-out of local authentication and + /// ensure customers can use only MSI and AAD exclusively for + /// authentication. + public DataFactory(string computeLocation = default(string), string provisioningState = default(string), string description = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? modifiedOn = default(System.DateTime?), string resourceId = default(string), IList provisioningErrors = default(IList), bool? isAttachedCompute = default(bool?), bool? disableLocalAuth = default(bool?)) + : base(computeLocation, provisioningState, description, createdOn, modifiedOn, resourceId, provisioningErrors, isAttachedCompute, disableLocalAuth) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataLakeAnalytics.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataLakeAnalytics.cs new file mode 100644 index 000000000000..e70077501bd4 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataLakeAnalytics.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A DataLakeAnalytics compute. + /// + public partial class DataLakeAnalytics : Compute + { + /// + /// Initializes a new instance of the DataLakeAnalytics class. + /// + public DataLakeAnalytics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataLakeAnalytics class. + /// + /// Location for the underlying + /// compute + /// The provision state of the cluster. + /// Valid values are Unknown, Updating, Provisioning, Succeeded, and + /// Failed. Possible values include: 'Unknown', 'Updating', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// The description of the Machine Learning + /// compute. + /// The time at which the compute was + /// created. + /// The time at which the compute was last + /// modified. + /// ARM resource id of the underlying + /// compute + /// Errors during provisioning + /// Indicating whether the compute was + /// provisioned by user and brought from outside if true, or machine + /// learning service provisioned it if false. + /// Opt-out of local authentication and + /// ensure customers can use only MSI and AAD exclusively for + /// authentication. + public DataLakeAnalytics(string computeLocation = default(string), string provisioningState = default(string), string description = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? modifiedOn = default(System.DateTime?), string resourceId = default(string), IList provisioningErrors = default(IList), bool? isAttachedCompute = default(bool?), bool? disableLocalAuth = default(bool?), DataLakeAnalyticsProperties properties = default(DataLakeAnalyticsProperties)) + : base(computeLocation, provisioningState, description, createdOn, modifiedOn, resourceId, provisioningErrors, isAttachedCompute, disableLocalAuth) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties")] + public DataLakeAnalyticsProperties Properties { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataLakeAnalyticsProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataLakeAnalyticsProperties.cs new file mode 100644 index 000000000000..fa9841e8f223 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataLakeAnalyticsProperties.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class DataLakeAnalyticsProperties + { + /// + /// Initializes a new instance of the DataLakeAnalyticsProperties + /// class. + /// + public DataLakeAnalyticsProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataLakeAnalyticsProperties + /// class. + /// + /// DataLake Store Account + /// Name + public DataLakeAnalyticsProperties(string dataLakeStoreAccountName = default(string)) + { + DataLakeStoreAccountName = dataLakeStoreAccountName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets dataLake Store Account Name + /// + [JsonProperty(PropertyName = "dataLakeStoreAccountName")] + public string DataLakeStoreAccountName { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataPathAssetReference.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataPathAssetReference.cs new file mode 100644 index 000000000000..10aea93ced2c --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataPathAssetReference.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Reference to an asset via its path in a datastore. + /// + [Newtonsoft.Json.JsonObject("DataPath")] + public partial class DataPathAssetReference : AssetReferenceBase + { + /// + /// Initializes a new instance of the DataPathAssetReference class. + /// + public DataPathAssetReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataPathAssetReference class. + /// + /// ARM resource ID of the datastore where + /// the asset is located. + /// The path of the file/directory in the + /// datastore. + public DataPathAssetReference(string datastoreId = default(string), string path = default(string)) + { + DatastoreId = datastoreId; + Path = path; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ARM resource ID of the datastore where the asset is + /// located. + /// + [JsonProperty(PropertyName = "datastoreId")] + public string DatastoreId { get; set; } + + /// + /// Gets or sets the path of the file/directory in the datastore. + /// + [JsonProperty(PropertyName = "path")] + public string Path { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataVersion.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataVersion.cs new file mode 100644 index 000000000000..1be106b2a78c --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataVersion.cs @@ -0,0 +1,131 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Data asset version details. + /// + public partial class DataVersion + { + /// + /// Initializes a new instance of the DataVersion class. + /// + public DataVersion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataVersion class. + /// + /// The path of the file/directory in the + /// datastore. + /// The Format of dataset. Possible values + /// include: 'Simple', 'Dataflow' + /// ARM resource ID of the datastore where + /// the asset is located. + /// The asset description text. + /// If the name version are system generated + /// (anonymous registration). + /// The asset property dictionary. + /// Tag dictionary. Tags can be added, removed, and + /// updated. + public DataVersion(string path, string datasetType = default(string), string datastoreId = default(string), string description = default(string), bool? isAnonymous = default(bool?), IDictionary properties = default(IDictionary), IDictionary tags = default(IDictionary)) + { + DatasetType = datasetType; + DatastoreId = datastoreId; + Description = description; + IsAnonymous = isAnonymous; + Path = path; + Properties = properties; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Format of dataset. Possible values include: + /// 'Simple', 'Dataflow' + /// + [JsonProperty(PropertyName = "datasetType")] + public string DatasetType { get; set; } + + /// + /// Gets or sets ARM resource ID of the datastore where the asset is + /// located. + /// + [JsonProperty(PropertyName = "datastoreId")] + public string DatastoreId { get; set; } + + /// + /// Gets or sets the asset description text. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets if the name version are system generated (anonymous + /// registration). + /// + [JsonProperty(PropertyName = "isAnonymous")] + public bool? IsAnonymous { get; set; } + + /// + /// Gets or sets the path of the file/directory in the datastore. + /// + [JsonProperty(PropertyName = "path")] + public string Path { get; set; } + + /// + /// Gets or sets the asset property dictionary. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets or sets tag dictionary. Tags can be added, removed, and + /// updated. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Path == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Path"); + } + if (Path != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Path, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Path", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataVersionResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataVersionResource.cs new file mode 100644 index 000000000000..8a02485fd266 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DataVersionResource.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Resource Manager resource envelope. + /// + public partial class DataVersionResource : Resource + { + /// + /// Initializes a new instance of the DataVersionResource class. + /// + public DataVersionResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataVersionResource class. + /// + /// Additional attributes of the + /// entity. + /// 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" + /// System data associated with resource + /// provider + public DataVersionResource(DataVersion properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public DataVersion Properties { get; set; } + + /// + /// Gets system data associated with resource provider + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Databricks.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Databricks.cs new file mode 100644 index 000000000000..8dde59e0ded7 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Databricks.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A DataFactory compute. + /// + public partial class Databricks : Compute + { + /// + /// Initializes a new instance of the Databricks class. + /// + public Databricks() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Databricks class. + /// + /// Location for the underlying + /// compute + /// The provision state of the cluster. + /// Valid values are Unknown, Updating, Provisioning, Succeeded, and + /// Failed. Possible values include: 'Unknown', 'Updating', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// The description of the Machine Learning + /// compute. + /// The time at which the compute was + /// created. + /// The time at which the compute was last + /// modified. + /// ARM resource id of the underlying + /// compute + /// Errors during provisioning + /// Indicating whether the compute was + /// provisioned by user and brought from outside if true, or machine + /// learning service provisioned it if false. + /// Opt-out of local authentication and + /// ensure customers can use only MSI and AAD exclusively for + /// authentication. + public Databricks(string computeLocation = default(string), string provisioningState = default(string), string description = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? modifiedOn = default(System.DateTime?), string resourceId = default(string), IList provisioningErrors = default(IList), bool? isAttachedCompute = default(bool?), bool? disableLocalAuth = default(bool?), DatabricksProperties properties = default(DatabricksProperties)) + : base(computeLocation, provisioningState, description, createdOn, modifiedOn, resourceId, provisioningErrors, isAttachedCompute, disableLocalAuth) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties")] + public DatabricksProperties Properties { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatabricksComputeSecrets.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatabricksComputeSecrets.cs new file mode 100644 index 000000000000..6b859c12da66 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatabricksComputeSecrets.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Secrets related to a Machine Learning compute based on Databricks. + /// + [Newtonsoft.Json.JsonObject("Databricks")] + public partial class DatabricksComputeSecrets : ComputeSecrets + { + /// + /// Initializes a new instance of the DatabricksComputeSecrets class. + /// + public DatabricksComputeSecrets() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabricksComputeSecrets class. + /// + /// access token for databricks + /// account. + public DatabricksComputeSecrets(string databricksAccessToken = default(string)) + { + DatabricksAccessToken = databricksAccessToken; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets access token for databricks account. + /// + [JsonProperty(PropertyName = "databricksAccessToken")] + public string DatabricksAccessToken { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatabricksProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatabricksProperties.cs new file mode 100644 index 000000000000..0d34d3c39b77 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatabricksProperties.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class DatabricksProperties + { + /// + /// Initializes a new instance of the DatabricksProperties class. + /// + public DatabricksProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabricksProperties class. + /// + /// Databricks access token + /// Workspace Url + public DatabricksProperties(string databricksAccessToken = default(string), string workspaceUrl = default(string)) + { + DatabricksAccessToken = databricksAccessToken; + WorkspaceUrl = workspaceUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets databricks access token + /// + [JsonProperty(PropertyName = "databricksAccessToken")] + public string DatabricksAccessToken { get; set; } + + /// + /// Gets or sets workspace Url + /// + [JsonProperty(PropertyName = "workspaceUrl")] + public string WorkspaceUrl { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatasetExportSummary.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatasetExportSummary.cs new file mode 100644 index 000000000000..501b9a08ccb7 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatasetExportSummary.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + [Newtonsoft.Json.JsonObject("Dataset")] + public partial class DatasetExportSummary : ExportSummary + { + /// + /// Initializes a new instance of the DatasetExportSummary class. + /// + public DatasetExportSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatasetExportSummary class. + /// + /// The time when the export was + /// completed. + /// The total number of labeled + /// datapoints exported. + /// Name and identifier of the job + /// containing exported labels. + /// The time when the export was + /// requested. + /// The unique name of the labeled data + /// asset. + public DatasetExportSummary(System.DateTime? endTimeUtc = default(System.DateTime?), long? exportedRowCount = default(long?), string labelingJobId = default(string), System.DateTime? startTimeUtc = default(System.DateTime?), string labeledAssetName = default(string)) + : base(endTimeUtc, exportedRowCount, labelingJobId, startTimeUtc) + { + LabeledAssetName = labeledAssetName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the unique name of the labeled data asset. + /// + [JsonProperty(PropertyName = "labeledAssetName")] + public string LabeledAssetName { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatasetType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatasetType.cs new file mode 100644 index 000000000000..bbf8e3bdad18 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatasetType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for DatasetType. + /// + public static class DatasetType + { + public const string Simple = "Simple"; + public const string Dataflow = "Dataflow"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatastoreContents.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatastoreContents.cs new file mode 100644 index 000000000000..355b65e56c8e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatastoreContents.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.Azure.Management.MachineLearningServices.Models +{ + using System.Linq; + + /// + /// Base definition for datastore contents configuration. + /// + public partial class DatastoreContents + { + /// + /// Initializes a new instance of the DatastoreContents class. + /// + public DatastoreContents() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatastoreCredentials.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatastoreCredentials.cs new file mode 100644 index 000000000000..949bc5f10ec8 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatastoreCredentials.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.Azure.Management.MachineLearningServices.Models +{ + using System.Linq; + + /// + /// Base definition for datastore credentials. + /// + public partial class DatastoreCredentials + { + /// + /// Initializes a new instance of the DatastoreCredentials class. + /// + public DatastoreCredentials() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatastoreProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatastoreProperties.cs new file mode 100644 index 000000000000..714edbc7ee57 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatastoreProperties.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Datastore definition. + /// + public partial class DatastoreProperties + { + /// + /// Initializes a new instance of the DatastoreProperties class. + /// + public DatastoreProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatastoreProperties class. + /// + /// Reference to the datastore storage + /// contents. + /// The asset description text. + /// Whether the service has validated + /// access to the datastore with the provided credentials. + /// Whether this datastore is the default for + /// the workspace. + /// Information about the datastore origin, if + /// linked. + /// The asset property dictionary. + /// Tag dictionary. Tags can be added, removed, and + /// updated. + public DatastoreProperties(DatastoreContents contents, string description = default(string), bool? hasBeenValidated = default(bool?), bool? isDefault = default(bool?), LinkedInfo linkedInfo = default(LinkedInfo), IDictionary properties = default(IDictionary), IDictionary tags = default(IDictionary)) + { + Contents = contents; + Description = description; + HasBeenValidated = hasBeenValidated; + IsDefault = isDefault; + LinkedInfo = linkedInfo; + Properties = properties; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets reference to the datastore storage contents. + /// + [JsonProperty(PropertyName = "contents")] + public DatastoreContents Contents { get; set; } + + /// + /// Gets or sets the asset description text. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets whether the service has validated access to the datastore with + /// the provided credentials. + /// + [JsonProperty(PropertyName = "hasBeenValidated")] + public bool? HasBeenValidated { get; private set; } + + /// + /// Gets or sets whether this datastore is the default for the + /// workspace. + /// + [JsonProperty(PropertyName = "isDefault")] + public bool? IsDefault { get; set; } + + /// + /// Gets or sets information about the datastore origin, if linked. + /// + [JsonProperty(PropertyName = "linkedInfo")] + public LinkedInfo LinkedInfo { get; set; } + + /// + /// Gets or sets the asset property dictionary. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets or sets tag dictionary. Tags can be added, removed, and + /// updated. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Contents == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Contents"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatastorePropertiesResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatastorePropertiesResource.cs new file mode 100644 index 000000000000..517e9adde953 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatastorePropertiesResource.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Resource Manager resource envelope. + /// + public partial class DatastorePropertiesResource : Resource + { + /// + /// Initializes a new instance of the DatastorePropertiesResource + /// class. + /// + public DatastorePropertiesResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatastorePropertiesResource + /// class. + /// + /// Additional attributes of the + /// entity. + /// 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" + /// System data associated with resource + /// provider + public DatastorePropertiesResource(DatastoreProperties properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public DatastoreProperties Properties { get; set; } + + /// + /// Gets system data associated with resource provider + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatastoreSecrets.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatastoreSecrets.cs new file mode 100644 index 000000000000..8b5e5b1f7963 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DatastoreSecrets.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.Azure.Management.MachineLearningServices.Models +{ + using System.Linq; + + /// + /// Base definition for datastore secrets. + /// + public partial class DatastoreSecrets + { + /// + /// Initializes a new instance of the DatastoreSecrets class. + /// + public DatastoreSecrets() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DaysOfWeek.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DaysOfWeek.cs new file mode 100644 index 000000000000..b64a54879e84 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DaysOfWeek.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for DaysOfWeek. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DaysOfWeek + { + [EnumMember(Value = "Sunday")] + Sunday, + [EnumMember(Value = "Monday")] + Monday, + [EnumMember(Value = "Tuesday")] + Tuesday, + [EnumMember(Value = "Wednesday")] + Wednesday, + [EnumMember(Value = "Thursday")] + Thursday, + [EnumMember(Value = "Friday")] + Friday, + [EnumMember(Value = "Saturday")] + Saturday + } + internal static class DaysOfWeekEnumExtension + { + internal static string ToSerializedValue(this DaysOfWeek? value) + { + return value == null ? null : ((DaysOfWeek)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DaysOfWeek value) + { + switch( value ) + { + case DaysOfWeek.Sunday: + return "Sunday"; + case DaysOfWeek.Monday: + return "Monday"; + case DaysOfWeek.Tuesday: + return "Tuesday"; + case DaysOfWeek.Wednesday: + return "Wednesday"; + case DaysOfWeek.Thursday: + return "Thursday"; + case DaysOfWeek.Friday: + return "Friday"; + case DaysOfWeek.Saturday: + return "Saturday"; + } + return null; + } + + internal static DaysOfWeek? ParseDaysOfWeek(this string value) + { + switch( value ) + { + case "Sunday": + return DaysOfWeek.Sunday; + case "Monday": + return DaysOfWeek.Monday; + case "Tuesday": + return DaysOfWeek.Tuesday; + case "Wednesday": + return DaysOfWeek.Wednesday; + case "Thursday": + return DaysOfWeek.Thursday; + case "Friday": + return DaysOfWeek.Friday; + case "Saturday": + return DaysOfWeek.Saturday; + } + return null; + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DeploymentLogs.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DeploymentLogs.cs new file mode 100644 index 000000000000..86d888d98d99 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DeploymentLogs.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class DeploymentLogs + { + /// + /// Initializes a new instance of the DeploymentLogs class. + /// + public DeploymentLogs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentLogs class. + /// + /// The retrieved online deployment logs. + public DeploymentLogs(string content = default(string)) + { + Content = content; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the retrieved online deployment logs. + /// + [JsonProperty(PropertyName = "content")] + public string Content { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DeploymentLogsRequest.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DeploymentLogsRequest.cs new file mode 100644 index 000000000000..ccec5941d3e5 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DeploymentLogsRequest.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class DeploymentLogsRequest + { + /// + /// Initializes a new instance of the DeploymentLogsRequest class. + /// + public DeploymentLogsRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentLogsRequest class. + /// + /// The type of container to retrieve logs + /// from. Possible values include: 'StorageInitializer', + /// 'InferenceServer' + /// The maximum number of lines to tail. + public DeploymentLogsRequest(string containerType = default(string), int? tail = default(int?)) + { + ContainerType = containerType; + Tail = tail; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of container to retrieve logs from. Possible + /// values include: 'StorageInitializer', 'InferenceServer' + /// + [JsonProperty(PropertyName = "containerType")] + public string ContainerType { get; set; } + + /// + /// Gets or sets the maximum number of lines to tail. + /// + [JsonProperty(PropertyName = "tail")] + public int? Tail { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DeploymentProvisioningState.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DeploymentProvisioningState.cs new file mode 100644 index 000000000000..f414828b14c3 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DeploymentProvisioningState.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for DeploymentProvisioningState. + /// + public static class DeploymentProvisioningState + { + public const string Creating = "Creating"; + public const string Deleting = "Deleting"; + public const string Scaling = "Scaling"; + public const string Updating = "Updating"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DistributionConfiguration.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DistributionConfiguration.cs new file mode 100644 index 000000000000..82a1a2c32090 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DistributionConfiguration.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.Azure.Management.MachineLearningServices.Models +{ + using System.Linq; + + /// + /// Base definition for job distribution configuration. + /// + public partial class DistributionConfiguration + { + /// + /// Initializes a new instance of the DistributionConfiguration class. + /// + public DistributionConfiguration() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DistributionType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DistributionType.cs new file mode 100644 index 000000000000..51fd16ba86f6 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DistributionType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for DistributionType. + /// + public static class DistributionType + { + public const string PyTorch = "PyTorch"; + public const string TensorFlow = "TensorFlow"; + public const string Mpi = "Mpi"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DockerBuild.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DockerBuild.cs new file mode 100644 index 000000000000..d7070eb8206d --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DockerBuild.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class to represent configuration settings for Docker Build + /// + [Newtonsoft.Json.JsonObject("Build")] + public partial class DockerBuild : DockerSpecification + { + /// + /// Initializes a new instance of the DockerBuild class. + /// + public DockerBuild() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DockerBuild class. + /// + /// Docker command line instructions to + /// assemble an image. + /// <seealso + /// href="https://repo2docker.readthedocs.io/en/latest/config_files.html#dockerfile-advanced-environments" + /// /> + /// The platform information of the docker + /// image. + /// Path to a snapshot of the Docker Context. + /// This property is only valid if Dockerfile is specified. + /// The path is relative to the asset path which must contain a single + /// Blob URI value. + /// <seealso + /// href="https://docs.docker.com/engine/context/working-with-contexts/" + /// /> + public DockerBuild(string dockerfile, DockerImagePlatform platform = default(DockerImagePlatform), string context = default(string)) + : base(platform) + { + Context = context; + Dockerfile = dockerfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets path to a snapshot of the Docker Context. This + /// property is only valid if Dockerfile is specified. + /// The path is relative to the asset path which must contain a single + /// Blob URI value. + /// &lt;seealso + /// href="https://docs.docker.com/engine/context/working-with-contexts/" + /// /&gt; + /// + [JsonProperty(PropertyName = "context")] + public string Context { get; set; } + + /// + /// Gets or sets docker command line instructions to assemble an image. + /// &lt;seealso + /// href="https://repo2docker.readthedocs.io/en/latest/config_files.html#dockerfile-advanced-environments" + /// /&gt; + /// + [JsonProperty(PropertyName = "dockerfile")] + public string Dockerfile { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Dockerfile == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Dockerfile"); + } + if (Dockerfile != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Dockerfile, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Dockerfile", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DockerImage.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DockerImage.cs new file mode 100644 index 000000000000..397e08bc6fda --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DockerImage.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class to represent configuration settings for Docker Build + /// + [Newtonsoft.Json.JsonObject("Image")] + public partial class DockerImage : DockerSpecification + { + /// + /// Initializes a new instance of the DockerImage class. + /// + public DockerImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DockerImage class. + /// + /// Image name of a custom base image. + /// <seealso + /// href="https://docs.microsoft.com/en-us/azure/machine-learning/how-to-deploy-custom-docker-image#use-a-custom-base-image" + /// /> + /// The platform information of the docker + /// image. + public DockerImage(string dockerImageUri, DockerImagePlatform platform = default(DockerImagePlatform)) + : base(platform) + { + DockerImageUri = dockerImageUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets image name of a custom base image. + /// &lt;seealso + /// href="https://docs.microsoft.com/en-us/azure/machine-learning/how-to-deploy-custom-docker-image#use-a-custom-base-image" + /// /&gt; + /// + [JsonProperty(PropertyName = "dockerImageUri")] + public string DockerImageUri { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DockerImageUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DockerImageUri"); + } + if (DockerImageUri != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(DockerImageUri, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "DockerImageUri", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DockerImagePlatform.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DockerImagePlatform.cs new file mode 100644 index 000000000000..c3e8602ae280 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DockerImagePlatform.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class DockerImagePlatform + { + /// + /// Initializes a new instance of the DockerImagePlatform class. + /// + public DockerImagePlatform() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DockerImagePlatform class. + /// + /// The OS type the Environment. + /// Possible values include: 'Linux', 'Windows' + public DockerImagePlatform(string operatingSystemType = default(string)) + { + OperatingSystemType = operatingSystemType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the OS type the Environment. Possible values include: + /// 'Linux', 'Windows' + /// + [JsonProperty(PropertyName = "operatingSystemType")] + public string OperatingSystemType { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DockerSpecification.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DockerSpecification.cs new file mode 100644 index 000000000000..a487600ef71c --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DockerSpecification.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Configuration settings for Docker + /// + public partial class DockerSpecification + { + /// + /// Initializes a new instance of the DockerSpecification class. + /// + public DockerSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DockerSpecification class. + /// + /// The platform information of the docker + /// image. + public DockerSpecification(DockerImagePlatform platform = default(DockerImagePlatform)) + { + Platform = platform; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the platform information of the docker image. + /// + [JsonProperty(PropertyName = "platform")] + public DockerImagePlatform Platform { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DockerSpecificationType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DockerSpecificationType.cs new file mode 100644 index 000000000000..b0c498f2d1df --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/DockerSpecificationType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for DockerSpecificationType. + /// + public static class DockerSpecificationType + { + public const string Build = "Build"; + public const string Image = "Image"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EarlyTerminationPolicy.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EarlyTerminationPolicy.cs new file mode 100644 index 000000000000..8ac2e22db26e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EarlyTerminationPolicy.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Early termination policies enable canceling poor-performing runs before + /// they complete. + /// + public partial class EarlyTerminationPolicy + { + /// + /// Initializes a new instance of the EarlyTerminationPolicy class. + /// + public EarlyTerminationPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EarlyTerminationPolicy class. + /// + /// Number of intervals by which to delay + /// the first evaluation. + /// Interval (number of runs) between + /// policy evaluations. + public EarlyTerminationPolicy(int? delayEvaluation = default(int?), int? evaluationInterval = default(int?)) + { + DelayEvaluation = delayEvaluation; + EvaluationInterval = evaluationInterval; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets number of intervals by which to delay the first + /// evaluation. + /// + [JsonProperty(PropertyName = "delayEvaluation")] + public int? DelayEvaluation { get; set; } + + /// + /// Gets or sets interval (number of runs) between policy evaluations. + /// + [JsonProperty(PropertyName = "evaluationInterval")] + public int? EvaluationInterval { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EarlyTerminationPolicyType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EarlyTerminationPolicyType.cs new file mode 100644 index 000000000000..a50d19ef043b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EarlyTerminationPolicyType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for EarlyTerminationPolicyType. + /// + public static class EarlyTerminationPolicyType + { + public const string Bandit = "Bandit"; + public const string MedianStopping = "MedianStopping"; + public const string TruncationSelection = "TruncationSelection"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EncryptionProperty.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EncryptionProperty.cs new file mode 100644 index 000000000000..c320061c25e8 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EncryptionProperty.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + public partial class EncryptionProperty + { + /// + /// Initializes a new instance of the EncryptionProperty class. + /// + public EncryptionProperty() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EncryptionProperty class. + /// + /// Indicates whether or not the encryption is + /// enabled for the workspace. Possible values include: 'Enabled', + /// 'Disabled' + /// Customer Key vault + /// properties. + /// The identity that will be used to access the + /// key vault for encryption at rest. + public EncryptionProperty(string status, KeyVaultProperties keyVaultProperties, IdentityForCmk identity = default(IdentityForCmk)) + { + Status = status; + Identity = identity; + KeyVaultProperties = keyVaultProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether or not the encryption is enabled for + /// the workspace. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the identity that will be used to access the key vault + /// for encryption at rest. + /// + [JsonProperty(PropertyName = "identity")] + public IdentityForCmk Identity { get; set; } + + /// + /// Gets or sets customer Key vault properties. + /// + [JsonProperty(PropertyName = "keyVaultProperties")] + public KeyVaultProperties KeyVaultProperties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Status == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + } + if (KeyVaultProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyVaultProperties"); + } + if (KeyVaultProperties != null) + { + KeyVaultProperties.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EncryptionStatus.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EncryptionStatus.cs new file mode 100644 index 000000000000..b57375b90fe3 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EncryptionStatus.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for EncryptionStatus. + /// + public static class EncryptionStatus + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EndpointAuthKeys.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EndpointAuthKeys.cs new file mode 100644 index 000000000000..238eeeed0720 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EndpointAuthKeys.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Keys for endpoint authentication. + /// + public partial class EndpointAuthKeys + { + /// + /// Initializes a new instance of the EndpointAuthKeys class. + /// + public EndpointAuthKeys() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EndpointAuthKeys class. + /// + /// The primary key. + /// The secondary key. + public EndpointAuthKeys(string primaryKey = default(string), string secondaryKey = default(string)) + { + PrimaryKey = primaryKey; + SecondaryKey = secondaryKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the primary key. + /// + [JsonProperty(PropertyName = "primaryKey")] + public string PrimaryKey { get; set; } + + /// + /// Gets or sets the secondary key. + /// + [JsonProperty(PropertyName = "secondaryKey")] + public string SecondaryKey { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EndpointAuthMode.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EndpointAuthMode.cs new file mode 100644 index 000000000000..75797b988a87 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EndpointAuthMode.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for EndpointAuthMode. + /// + public static class EndpointAuthMode + { + public const string AMLToken = "AMLToken"; + public const string Key = "Key"; + public const string AADToken = "AADToken"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EndpointAuthToken.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EndpointAuthToken.cs new file mode 100644 index 000000000000..bc1c2cf6d91c --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EndpointAuthToken.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Service Token + /// + public partial class EndpointAuthToken + { + /// + /// Initializes a new instance of the EndpointAuthToken class. + /// + public EndpointAuthToken() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EndpointAuthToken class. + /// + /// Access token. + /// Access token expiry time (UTC). + /// Refresh access token after time + /// (UTC). + /// Access token type. + public EndpointAuthToken(string accessToken = default(string), long? expiryTimeUtc = default(long?), long? refreshAfterTimeUtc = default(long?), string tokenType = default(string)) + { + AccessToken = accessToken; + ExpiryTimeUtc = expiryTimeUtc; + RefreshAfterTimeUtc = refreshAfterTimeUtc; + TokenType = tokenType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets access token. + /// + [JsonProperty(PropertyName = "accessToken")] + public string AccessToken { get; set; } + + /// + /// Gets or sets access token expiry time (UTC). + /// + [JsonProperty(PropertyName = "expiryTimeUtc")] + public long? ExpiryTimeUtc { get; set; } + + /// + /// Gets or sets refresh access token after time (UTC). + /// + [JsonProperty(PropertyName = "refreshAfterTimeUtc")] + public long? RefreshAfterTimeUtc { get; set; } + + /// + /// Gets or sets access token type. + /// + [JsonProperty(PropertyName = "tokenType")] + public string TokenType { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EndpointComputeType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EndpointComputeType.cs new file mode 100644 index 000000000000..9015d6518d0f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EndpointComputeType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for EndpointComputeType. + /// + public static class EndpointComputeType + { + public const string Managed = "Managed"; + public const string K8S = "K8S"; + public const string AzureMLCompute = "AzureMLCompute"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EndpointProvisioningState.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EndpointProvisioningState.cs new file mode 100644 index 000000000000..59c57bbd0919 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EndpointProvisioningState.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for EndpointProvisioningState. + /// + public static class EndpointProvisioningState + { + public const string Creating = "Creating"; + public const string Deleting = "Deleting"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Updating = "Updating"; + public const string Canceled = "Canceled"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EnvironmentContainer.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EnvironmentContainer.cs new file mode 100644 index 000000000000..e61f1bb4fe33 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EnvironmentContainer.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Container for environment specification versions. + /// + public partial class EnvironmentContainer + { + /// + /// Initializes a new instance of the EnvironmentContainer class. + /// + public EnvironmentContainer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnvironmentContainer class. + /// + /// The asset description text. + /// The asset property dictionary. + /// Tag dictionary. Tags can be added, removed, and + /// updated. + public EnvironmentContainer(string description = default(string), IDictionary properties = default(IDictionary), IDictionary tags = default(IDictionary)) + { + Description = description; + Properties = properties; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the asset description text. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the asset property dictionary. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets or sets tag dictionary. Tags can be added, removed, and + /// updated. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EnvironmentContainerResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EnvironmentContainerResource.cs new file mode 100644 index 000000000000..470687daf050 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EnvironmentContainerResource.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Resource Manager resource envelope. + /// + public partial class EnvironmentContainerResource : Resource + { + /// + /// Initializes a new instance of the EnvironmentContainerResource + /// class. + /// + public EnvironmentContainerResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnvironmentContainerResource + /// class. + /// + /// Additional attributes of the + /// entity. + /// 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" + /// System data associated with resource + /// provider + public EnvironmentContainerResource(EnvironmentContainer properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public EnvironmentContainer Properties { get; set; } + + /// + /// Gets system data associated with resource provider + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EnvironmentSpecificationType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EnvironmentSpecificationType.cs new file mode 100644 index 000000000000..acd2ceb9abb2 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EnvironmentSpecificationType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for EnvironmentSpecificationType. + /// + public static class EnvironmentSpecificationType + { + public const string Curated = "Curated"; + public const string UserCreated = "UserCreated"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EnvironmentSpecificationVersion.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EnvironmentSpecificationVersion.cs new file mode 100644 index 000000000000..83217cc80afc --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EnvironmentSpecificationVersion.cs @@ -0,0 +1,151 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Environment specification version details. + /// <see + /// href="https://repo2docker.readthedocs.io/en/latest/specification.html" + /// /> + /// + public partial class EnvironmentSpecificationVersion + { + /// + /// Initializes a new instance of the EnvironmentSpecificationVersion + /// class. + /// + public EnvironmentSpecificationVersion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnvironmentSpecificationVersion + /// class. + /// + /// Standard configuration file used by Conda + /// that lets you install any kind of package, including Python, R, and + /// C/C++ packages. + /// <see + /// href="https://repo2docker.readthedocs.io/en/latest/config_files.html#environment-yml-install-a-conda-environment" + /// /> + /// The asset description text. + /// Configuration settings for Docker. + /// Environment + /// specification is either user managed or curated by the Azure ML + /// service + /// <see + /// href="https://docs.microsoft.com/en-us/azure/machine-learning/resource-curated-environments" + /// />. Possible values include: 'Curated', 'UserCreated' + /// Defines configuration + /// specific to inference. + /// If the name version are system generated + /// (anonymous registration). + /// The asset property dictionary. + /// Tag dictionary. Tags can be added, removed, and + /// updated. + public EnvironmentSpecificationVersion(string condaFile = default(string), string description = default(string), DockerSpecification docker = default(DockerSpecification), string environmentSpecificationType = default(string), InferenceContainerProperties inferenceContainerProperties = default(InferenceContainerProperties), bool? isAnonymous = default(bool?), IDictionary properties = default(IDictionary), IDictionary tags = default(IDictionary)) + { + CondaFile = condaFile; + Description = description; + Docker = docker; + EnvironmentSpecificationType = environmentSpecificationType; + InferenceContainerProperties = inferenceContainerProperties; + IsAnonymous = isAnonymous; + Properties = properties; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets standard configuration file used by Conda that lets + /// you install any kind of package, including Python, R, and C/C++ + /// packages. + /// &lt;see + /// href="https://repo2docker.readthedocs.io/en/latest/config_files.html#environment-yml-install-a-conda-environment" + /// /&gt; + /// + [JsonProperty(PropertyName = "condaFile")] + public string CondaFile { get; set; } + + /// + /// Gets or sets the asset description text. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets configuration settings for Docker. + /// + [JsonProperty(PropertyName = "docker")] + public DockerSpecification Docker { get; set; } + + /// + /// Gets environment specification is either user managed or curated by + /// the Azure ML service + /// &lt;see + /// href="https://docs.microsoft.com/en-us/azure/machine-learning/resource-curated-environments" + /// /&gt;. Possible values include: 'Curated', 'UserCreated' + /// + [JsonProperty(PropertyName = "environmentSpecificationType")] + public string EnvironmentSpecificationType { get; private set; } + + /// + /// Gets or sets defines configuration specific to inference. + /// + [JsonProperty(PropertyName = "inferenceContainerProperties")] + public InferenceContainerProperties InferenceContainerProperties { get; set; } + + /// + /// Gets or sets if the name version are system generated (anonymous + /// registration). + /// + [JsonProperty(PropertyName = "isAnonymous")] + public bool? IsAnonymous { get; set; } + + /// + /// Gets or sets the asset property dictionary. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets or sets tag dictionary. Tags can be added, removed, and + /// updated. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (InferenceContainerProperties != null) + { + InferenceContainerProperties.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EnvironmentSpecificationVersionResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EnvironmentSpecificationVersionResource.cs new file mode 100644 index 000000000000..6c9e447ee994 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EnvironmentSpecificationVersionResource.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Resource Manager resource envelope. + /// + public partial class EnvironmentSpecificationVersionResource : Resource + { + /// + /// Initializes a new instance of the + /// EnvironmentSpecificationVersionResource class. + /// + public EnvironmentSpecificationVersionResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// EnvironmentSpecificationVersionResource class. + /// + /// Additional attributes of the + /// entity. + /// 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" + /// System data associated with resource + /// provider + public EnvironmentSpecificationVersionResource(EnvironmentSpecificationVersion properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public EnvironmentSpecificationVersion Properties { get; set; } + + /// + /// Gets system data associated with resource provider + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..42982b4887cf --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/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.Azure.Management.MachineLearningServices.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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ErrorDetail.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 000000000000..7c40028e1c31 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/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.Azure.Management.MachineLearningServices.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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ErrorResponse.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..55dfa4c50e70 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/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.Azure.Management.MachineLearningServices.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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ErrorResponseException.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..fae7141b6ea3 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/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.Azure.Management.MachineLearningServices.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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EstimatedVMPrice.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EstimatedVMPrice.cs new file mode 100644 index 000000000000..999963841b1a --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EstimatedVMPrice.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The estimated price info for using a VM of a particular OS type, tier, + /// etc. + /// + public partial class EstimatedVMPrice + { + /// + /// Initializes a new instance of the EstimatedVMPrice class. + /// + public EstimatedVMPrice() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EstimatedVMPrice class. + /// + /// Retail price + /// OS type + /// VM tier + public EstimatedVMPrice(double retailPrice, string osType, string vmTier) + { + RetailPrice = retailPrice; + OsType = osType; + VmTier = vmTier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets retail price + /// + /// + /// The price charged for using the VM. + /// + [JsonProperty(PropertyName = "retailPrice")] + public double RetailPrice { get; set; } + + /// + /// Gets or sets OS type + /// + /// + /// Operating system type used by the VM. Possible values include: + /// 'Linux', 'Windows' + /// + [JsonProperty(PropertyName = "osType")] + public string OsType { get; set; } + + /// + /// Gets or sets VM tier + /// + /// + /// The type of the VM. Possible values include: 'Standard', + /// 'LowPriority', 'Spot' + /// + [JsonProperty(PropertyName = "vmTier")] + public string VmTier { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OsType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OsType"); + } + if (VmTier == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VmTier"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EstimatedVMPrices.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EstimatedVMPrices.cs new file mode 100644 index 000000000000..98fe97c83397 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/EstimatedVMPrices.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The estimated price info for using a VM. + /// + public partial class EstimatedVMPrices + { + /// + /// Initializes a new instance of the EstimatedVMPrices class. + /// + public EstimatedVMPrices() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EstimatedVMPrices class. + /// + /// List of estimated VM prices. + public EstimatedVMPrices(IList values) + { + Values = values; + CustomInit(); + } + /// + /// Static constructor for EstimatedVMPrices class. + /// + static EstimatedVMPrices() + { + BillingCurrency = "USD"; + UnitOfMeasure = "OneHour"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of estimated VM prices. + /// + /// + /// The list of estimated prices for using a VM of a particular OS + /// type, tier, etc. + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; set; } + + /// + /// Three lettered code specifying the currency of the VM price. + /// Example: USD + /// + [JsonProperty(PropertyName = "billingCurrency")] + public static string BillingCurrency { get; private set; } + + /// + /// The unit of time measurement for the specified VM price. Example: + /// OneHour + /// + [JsonProperty(PropertyName = "unitOfMeasure")] + public static string UnitOfMeasure { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Values == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Values"); + } + if (Values != null) + { + foreach (var element in Values) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ExportFormatType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ExportFormatType.cs new file mode 100644 index 000000000000..cb26af176092 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ExportFormatType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ExportFormatType. + /// + public static class ExportFormatType + { + public const string Dataset = "Dataset"; + public const string Coco = "Coco"; + public const string CSV = "CSV"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ExportSummary.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ExportSummary.cs new file mode 100644 index 000000000000..91eabde89be7 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ExportSummary.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ExportSummary + { + /// + /// Initializes a new instance of the ExportSummary class. + /// + public ExportSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExportSummary class. + /// + /// The time when the export was + /// completed. + /// The total number of labeled + /// datapoints exported. + /// Name and identifier of the job + /// containing exported labels. + /// The time when the export was + /// requested. + public ExportSummary(System.DateTime? endTimeUtc = default(System.DateTime?), long? exportedRowCount = default(long?), string labelingJobId = default(string), System.DateTime? startTimeUtc = default(System.DateTime?)) + { + EndTimeUtc = endTimeUtc; + ExportedRowCount = exportedRowCount; + LabelingJobId = labelingJobId; + StartTimeUtc = startTimeUtc; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the time when the export was completed. + /// + [JsonProperty(PropertyName = "endTimeUtc")] + public System.DateTime? EndTimeUtc { get; private set; } + + /// + /// Gets the total number of labeled datapoints exported. + /// + [JsonProperty(PropertyName = "exportedRowCount")] + public long? ExportedRowCount { get; private set; } + + /// + /// Gets name and identifier of the job containing exported labels. + /// + [JsonProperty(PropertyName = "labelingJobId")] + public string LabelingJobId { get; private set; } + + /// + /// Gets the time when the export was requested. + /// + [JsonProperty(PropertyName = "startTimeUtc")] + public System.DateTime? StartTimeUtc { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/FlavorData.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/FlavorData.cs new file mode 100644 index 000000000000..1abf9427fdcc --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/FlavorData.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class FlavorData + { + /// + /// Initializes a new instance of the FlavorData class. + /// + public FlavorData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FlavorData class. + /// + /// Model flavor-specific data. + public FlavorData(IDictionary data = default(IDictionary)) + { + Data = data; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets model flavor-specific data. + /// + [JsonProperty(PropertyName = "data")] + public IDictionary Data { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/GlusterFsContents.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/GlusterFsContents.cs new file mode 100644 index 000000000000..7348b38472da --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/GlusterFsContents.cs @@ -0,0 +1,94 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// GlusterFs datastore configuration. + /// + [Newtonsoft.Json.JsonObject("GlusterFs")] + public partial class GlusterFsContents : DatastoreContents + { + /// + /// Initializes a new instance of the GlusterFsContents class. + /// + public GlusterFsContents() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GlusterFsContents class. + /// + /// GlusterFS server address (can be the IP + /// address or server name). + /// GlusterFS volume name. + public GlusterFsContents(string serverAddress, string volumeName) + { + ServerAddress = serverAddress; + VolumeName = volumeName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets glusterFS server address (can be the IP address or + /// server name). + /// + [JsonProperty(PropertyName = "serverAddress")] + public string ServerAddress { get; set; } + + /// + /// Gets or sets glusterFS volume name. + /// + [JsonProperty(PropertyName = "volumeName")] + public string VolumeName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ServerAddress == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ServerAddress"); + } + if (VolumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VolumeName"); + } + if (ServerAddress != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(ServerAddress, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "ServerAddress", "[a-zA-Z0-9_]"); + } + } + if (VolumeName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(VolumeName, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "VolumeName", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Goal.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Goal.cs new file mode 100644 index 000000000000..b84cf82e8f19 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Goal.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for Goal. + /// + public static class Goal + { + public const string Minimize = "Minimize"; + public const string Maximize = "Maximize"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/HDInsight.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/HDInsight.cs new file mode 100644 index 000000000000..6bcd38a8b8e8 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/HDInsight.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A HDInsight compute. + /// + public partial class HDInsight : Compute + { + /// + /// Initializes a new instance of the HDInsight class. + /// + public HDInsight() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HDInsight class. + /// + /// Location for the underlying + /// compute + /// The provision state of the cluster. + /// Valid values are Unknown, Updating, Provisioning, Succeeded, and + /// Failed. Possible values include: 'Unknown', 'Updating', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// The description of the Machine Learning + /// compute. + /// The time at which the compute was + /// created. + /// The time at which the compute was last + /// modified. + /// ARM resource id of the underlying + /// compute + /// Errors during provisioning + /// Indicating whether the compute was + /// provisioned by user and brought from outside if true, or machine + /// learning service provisioned it if false. + /// Opt-out of local authentication and + /// ensure customers can use only MSI and AAD exclusively for + /// authentication. + public HDInsight(string computeLocation = default(string), string provisioningState = default(string), string description = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? modifiedOn = default(System.DateTime?), string resourceId = default(string), IList provisioningErrors = default(IList), bool? isAttachedCompute = default(bool?), bool? disableLocalAuth = default(bool?), HDInsightProperties properties = default(HDInsightProperties)) + : base(computeLocation, provisioningState, description, createdOn, modifiedOn, resourceId, provisioningErrors, isAttachedCompute, disableLocalAuth) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties")] + public HDInsightProperties Properties { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/HDInsightProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/HDInsightProperties.cs new file mode 100644 index 000000000000..a50ec018664e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/HDInsightProperties.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class HDInsightProperties + { + /// + /// Initializes a new instance of the HDInsightProperties class. + /// + public HDInsightProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HDInsightProperties class. + /// + /// Port open for ssh connections on the master + /// node of the cluster. + /// Public IP address of the master node of the + /// cluster. + /// Admin credentials for master + /// node of the cluster + public HDInsightProperties(int? sshPort = default(int?), string address = default(string), VirtualMachineSshCredentials administratorAccount = default(VirtualMachineSshCredentials)) + { + SshPort = sshPort; + Address = address; + AdministratorAccount = administratorAccount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets port open for ssh connections on the master node of + /// the cluster. + /// + [JsonProperty(PropertyName = "sshPort")] + public int? SshPort { get; set; } + + /// + /// Gets or sets public IP address of the master node of the cluster. + /// + [JsonProperty(PropertyName = "address")] + public string Address { get; set; } + + /// + /// Gets or sets admin credentials for master node of the cluster + /// + [JsonProperty(PropertyName = "administratorAccount")] + public VirtualMachineSshCredentials AdministratorAccount { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/IdAssetReference.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/IdAssetReference.cs new file mode 100644 index 000000000000..53b8dfb3688f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/IdAssetReference.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Reference to an asset via its ARM resource ID. + /// + [Newtonsoft.Json.JsonObject("Id")] + public partial class IdAssetReference : AssetReferenceBase + { + /// + /// Initializes a new instance of the IdAssetReference class. + /// + public IdAssetReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IdAssetReference class. + /// + /// ARM resource ID of the asset. + public IdAssetReference(string assetId) + { + AssetId = assetId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ARM resource ID of the asset. + /// + [JsonProperty(PropertyName = "assetId")] + public string AssetId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AssetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AssetId"); + } + if (AssetId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(AssetId, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "AssetId", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Identity.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Identity.cs new file mode 100644 index 000000000000..edcbb9e6ac71 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Identity.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + 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', 'SystemAssigned,UserAssigned', 'UserAssigned', + /// 'None' + /// The user assigned identities + /// associated with the resource. + public Identity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?), IDictionary userAssignedIdentities = default(IDictionary)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + UserAssignedIdentities = userAssignedIdentities; + 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', 'SystemAssigned,UserAssigned', 'UserAssigned', + /// 'None' + /// + [JsonProperty(PropertyName = "type")] + public ResourceIdentityType? Type { get; set; } + + /// + /// Gets or sets the user assigned identities associated with the + /// resource. + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/IdentityConfiguration.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/IdentityConfiguration.cs new file mode 100644 index 000000000000..6e2629bad679 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/IdentityConfiguration.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.Azure.Management.MachineLearningServices.Models +{ + using System.Linq; + + /// + /// Base definition for identity configuration. + /// + public partial class IdentityConfiguration + { + /// + /// Initializes a new instance of the IdentityConfiguration class. + /// + public IdentityConfiguration() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/IdentityConfigurationType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/IdentityConfigurationType.cs new file mode 100644 index 000000000000..eeb5b12de960 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/IdentityConfigurationType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for IdentityConfigurationType. + /// + public static class IdentityConfigurationType + { + public const string Managed = "Managed"; + public const string AMLToken = "AMLToken"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/IdentityForCmk.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/IdentityForCmk.cs new file mode 100644 index 000000000000..09f9de4a2c13 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/IdentityForCmk.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Identity that will be used to access key vault for encryption at rest + /// + public partial class IdentityForCmk + { + /// + /// Initializes a new instance of the IdentityForCmk class. + /// + public IdentityForCmk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IdentityForCmk class. + /// + /// The ArmId of the user assigned + /// identity that will be used to access the customer managed key + /// vault + public IdentityForCmk(string userAssignedIdentity = default(string)) + { + UserAssignedIdentity = userAssignedIdentity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the ArmId of the user assigned identity that will be + /// used to access the customer managed key vault + /// + [JsonProperty(PropertyName = "userAssignedIdentity")] + public string UserAssignedIdentity { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ImageAnnotationType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ImageAnnotationType.cs new file mode 100644 index 000000000000..441f581987a0 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ImageAnnotationType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ImageAnnotationType. + /// + public static class ImageAnnotationType + { + public const string Classification = "Classification"; + public const string BoundingBox = "BoundingBox"; + public const string InstanceSegmentation = "InstanceSegmentation"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/InferenceContainerProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/InferenceContainerProperties.cs new file mode 100644 index 000000000000..79b44e8d55b0 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/InferenceContainerProperties.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class InferenceContainerProperties + { + /// + /// Initializes a new instance of the InferenceContainerProperties + /// class. + /// + public InferenceContainerProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InferenceContainerProperties + /// class. + /// + /// The route to check the liveness of the + /// inference server container. + /// The route to check the readiness of + /// the inference server container. + /// The port to send the scoring requests + /// to, within the inference server container. + public InferenceContainerProperties(Route livenessRoute = default(Route), Route readinessRoute = default(Route), Route scoringRoute = default(Route)) + { + LivenessRoute = livenessRoute; + ReadinessRoute = readinessRoute; + ScoringRoute = scoringRoute; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the route to check the liveness of the inference + /// server container. + /// + [JsonProperty(PropertyName = "livenessRoute")] + public Route LivenessRoute { get; set; } + + /// + /// Gets or sets the route to check the readiness of the inference + /// server container. + /// + [JsonProperty(PropertyName = "readinessRoute")] + public Route ReadinessRoute { get; set; } + + /// + /// Gets or sets the port to send the scoring requests to, within the + /// inference server container. + /// + [JsonProperty(PropertyName = "scoringRoute")] + public Route ScoringRoute { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (LivenessRoute != null) + { + LivenessRoute.Validate(); + } + if (ReadinessRoute != null) + { + ReadinessRoute.Validate(); + } + if (ScoringRoute != null) + { + ScoringRoute.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/InputDataBinding.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/InputDataBinding.cs new file mode 100644 index 000000000000..ded6d0c96b6b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/InputDataBinding.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class InputDataBinding + { + /// + /// Initializes a new instance of the InputDataBinding class. + /// + public InputDataBinding() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InputDataBinding class. + /// + /// ARM resource ID of the registered + /// dataVersion. + /// Mechanism for accessing the data artifact. + /// Possible values include: 'Mount', 'Download', 'Upload' + /// Location of data inside the container + /// process. + public InputDataBinding(string dataId = default(string), string mode = default(string), string pathOnCompute = default(string)) + { + DataId = dataId; + Mode = mode; + PathOnCompute = pathOnCompute; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ARM resource ID of the registered dataVersion. + /// + [JsonProperty(PropertyName = "dataId")] + public string DataId { get; set; } + + /// + /// Gets or sets mechanism for accessing the data artifact. Possible + /// values include: 'Mount', 'Download', 'Upload' + /// + [JsonProperty(PropertyName = "mode")] + public string Mode { get; set; } + + /// + /// Gets or sets location of data inside the container process. + /// + [JsonProperty(PropertyName = "pathOnCompute")] + public string PathOnCompute { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobBase.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobBase.cs new file mode 100644 index 000000000000..8107e0089d01 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobBase.cs @@ -0,0 +1,94 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Base definition for a job. + /// + public partial class JobBase + { + /// + /// Initializes a new instance of the JobBase class. + /// + public JobBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the JobBase class. + /// + /// The asset description text. + /// List of JobEndpoints. + /// For local jobs, a job endpoint will have an endpoint value of + /// FileStreamObject. + /// The asset property dictionary. + /// Specifies the job provisioning + /// state. Possible values include: 'Succeeded', 'Failed', 'Canceled', + /// 'InProgress' + /// Tag dictionary. Tags can be added, removed, and + /// updated. + public JobBase(string description = default(string), IDictionary interactionEndpoints = default(IDictionary), IDictionary properties = default(IDictionary), string provisioningState = default(string), IDictionary tags = default(IDictionary)) + { + Description = description; + InteractionEndpoints = interactionEndpoints; + Properties = properties; + ProvisioningState = provisioningState; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the asset description text. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets list of JobEndpoints. + /// For local jobs, a job endpoint will have an endpoint value of + /// FileStreamObject. + /// + [JsonProperty(PropertyName = "interactionEndpoints")] + public IDictionary InteractionEndpoints { get; private set; } + + /// + /// Gets or sets the asset property dictionary. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets specifies the job provisioning state. Possible values include: + /// 'Succeeded', 'Failed', 'Canceled', 'InProgress' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets tag dictionary. Tags can be added, removed, and + /// updated. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobBaseResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobBaseResource.cs new file mode 100644 index 000000000000..9bac806ddf3f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobBaseResource.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Resource Manager resource envelope. + /// + public partial class JobBaseResource : Resource + { + /// + /// Initializes a new instance of the JobBaseResource class. + /// + public JobBaseResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the JobBaseResource class. + /// + /// Additional attributes of the + /// entity. + /// 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" + /// System data associated with resource + /// provider + public JobBaseResource(JobBase properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public JobBase Properties { get; set; } + + /// + /// Gets system data associated with resource provider + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobEndpoint.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobEndpoint.cs new file mode 100644 index 000000000000..f8d6dabdcf94 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobEndpoint.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Job endpoint definition + /// + public partial class JobEndpoint + { + /// + /// Initializes a new instance of the JobEndpoint class. + /// + public JobEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the JobEndpoint class. + /// + /// Url for endpoint. + /// Endpoint type. + /// Port for endpoint. + /// Additional properties to set on the + /// endpoint. + public JobEndpoint(string endpoint = default(string), string jobEndpointType = default(string), int? port = default(int?), IDictionary properties = default(IDictionary)) + { + Endpoint = endpoint; + JobEndpointType = jobEndpointType; + Port = port; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets url for endpoint. + /// + [JsonProperty(PropertyName = "endpoint")] + public string Endpoint { get; set; } + + /// + /// Gets or sets endpoint type. + /// + [JsonProperty(PropertyName = "jobEndpointType")] + public string JobEndpointType { get; set; } + + /// + /// Gets or sets port for endpoint. + /// + [JsonProperty(PropertyName = "port")] + public int? Port { get; set; } + + /// + /// Gets or sets additional properties to set on the endpoint. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobOutput.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobOutput.cs new file mode 100644 index 000000000000..bc8de57b0fa0 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobOutput.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Job output definition container information on where to find job + /// output/logs. + /// + public partial class JobOutput + { + /// + /// Initializes a new instance of the JobOutput class. + /// + public JobOutput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the JobOutput class. + /// + /// ARM ID of the datastore where the job + /// logs and artifacts are stored, or null for the default container + /// ("azureml") in the workspace's storage account. + /// Path within the datastore to the job logs and + /// artifacts. + public JobOutput(string datastoreId = default(string), string path = default(string)) + { + DatastoreId = datastoreId; + Path = path; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets ARM ID of the datastore where the job logs and artifacts are + /// stored, or null for the default container ("azureml") in the + /// workspace's storage account. + /// + [JsonProperty(PropertyName = "datastoreId")] + public string DatastoreId { get; private set; } + + /// + /// Gets path within the datastore to the job logs and artifacts. + /// + [JsonProperty(PropertyName = "path")] + public string Path { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobProvisioningState.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobProvisioningState.cs new file mode 100644 index 000000000000..197de831fcaa --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobProvisioningState.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for JobProvisioningState. + /// + public static class JobProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + public const string InProgress = "InProgress"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobStatus.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobStatus.cs new file mode 100644 index 000000000000..9337a989d8ca --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobStatus.cs @@ -0,0 +1,34 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for JobStatus. + /// + public static class JobStatus + { + public const string NotStarted = "NotStarted"; + public const string Starting = "Starting"; + public const string Provisioning = "Provisioning"; + public const string Preparing = "Preparing"; + public const string Queued = "Queued"; + public const string Running = "Running"; + public const string Finalizing = "Finalizing"; + public const string CancelRequested = "CancelRequested"; + public const string Completed = "Completed"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + public const string NotResponding = "NotResponding"; + public const string Paused = "Paused"; + public const string Unknown = "Unknown"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobType.cs new file mode 100644 index 000000000000..113f5dbdb371 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for JobType. + /// + public static class JobType + { + public const string Command = "Command"; + public const string Sweep = "Sweep"; + public const string Labeling = "Labeling"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobsDeleteHeaders.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobsDeleteHeaders.cs new file mode 100644 index 000000000000..e084ccea0fa1 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/JobsDeleteHeaders.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class JobsDeleteHeaders + { + /// + /// Initializes a new instance of the JobsDeleteHeaders class. + /// + public JobsDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the JobsDeleteHeaders class. + /// + /// Timeout for the client to + /// use when polling the asynchronous operation. + /// URI to poll for asynchronous operation + /// result. + /// Duration the client should wait between + /// requests, in seconds. + public JobsDeleteHeaders(System.TimeSpan? xMsAsyncOperationTimeout = default(System.TimeSpan?), string location = default(string), int? retryAfter = default(int?)) + { + XMsAsyncOperationTimeout = xMsAsyncOperationTimeout; + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets timeout for the client to use when polling the + /// asynchronous operation. + /// + [JsonProperty(PropertyName = "x-ms-async-operation-timeout")] + public System.TimeSpan? XMsAsyncOperationTimeout { get; set; } + + /// + /// Gets or sets URI to poll for asynchronous operation result. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets duration the client should wait between requests, in + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/K8sOnlineDeployment.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/K8sOnlineDeployment.cs new file mode 100644 index 000000000000..d8e42b2a3d94 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/K8sOnlineDeployment.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + [Newtonsoft.Json.JsonObject("K8S")] + public partial class K8sOnlineDeployment : OnlineDeployment + { + /// + /// Initializes a new instance of the K8sOnlineDeployment class. + /// + public K8sOnlineDeployment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the K8sOnlineDeployment class. + /// + /// If true, enables Application + /// Insights logging. + /// Code configuration for the endpoint + /// deployment. + /// Description of the endpoint + /// deployment. + /// ARM resource ID of the environment + /// specification for the endpoint deployment. + /// Environment variables + /// configuration for the deployment. + /// Deployment container liveness/readiness + /// probe configuration. + /// Reference to the model asset for the endpoint + /// deployment. + /// Property dictionary. Properties can be + /// added, but not removed or altered. + /// Provisioning state for the endpoint + /// deployment. Possible values include: 'Creating', 'Deleting', + /// 'Scaling', 'Updating', 'Succeeded', 'Failed', 'Canceled' + /// Online deployment scoring requests + /// configuration. + /// Online deployment scaling + /// configuration. + /// Resource requirements + /// for each container instance within an online deployment. + public K8sOnlineDeployment(bool? appInsightsEnabled = default(bool?), CodeConfiguration codeConfiguration = default(CodeConfiguration), string description = default(string), string environmentId = default(string), IDictionary environmentVariables = default(IDictionary), ProbeSettings livenessProbe = default(ProbeSettings), AssetReferenceBase model = default(AssetReferenceBase), IDictionary properties = default(IDictionary), string provisioningState = default(string), OnlineRequestSettings requestSettings = default(OnlineRequestSettings), OnlineScaleSettings scaleSettings = default(OnlineScaleSettings), ContainerResourceRequirements containerResourceRequirements = default(ContainerResourceRequirements)) + : base(appInsightsEnabled, codeConfiguration, description, environmentId, environmentVariables, livenessProbe, model, properties, provisioningState, requestSettings, scaleSettings) + { + ContainerResourceRequirements = containerResourceRequirements; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource requirements for each container instance + /// within an online deployment. + /// + [JsonProperty(PropertyName = "containerResourceRequirements")] + public ContainerResourceRequirements ContainerResourceRequirements { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/KeyType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/KeyType.cs new file mode 100644 index 000000000000..b6f4d9940556 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/KeyType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for KeyType. + /// + public static class KeyType + { + public const string Primary = "Primary"; + public const string Secondary = "Secondary"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/KeyVaultProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/KeyVaultProperties.cs new file mode 100644 index 000000000000..0ef1e9d45244 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/KeyVaultProperties.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + public partial class KeyVaultProperties + { + /// + /// Initializes a new instance of the KeyVaultProperties class. + /// + public KeyVaultProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultProperties class. + /// + /// The ArmId of the keyVault where the + /// customer owned encryption key is present. + /// Key vault uri to access the encryption + /// key. + /// For future use - The client id of + /// the identity which will be used to access key vault. + public KeyVaultProperties(string keyVaultArmId, string keyIdentifier, string identityClientId = default(string)) + { + KeyVaultArmId = keyVaultArmId; + KeyIdentifier = keyIdentifier; + IdentityClientId = identityClientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the ArmId of the keyVault where the customer owned + /// encryption key is present. + /// + [JsonProperty(PropertyName = "keyVaultArmId")] + public string KeyVaultArmId { get; set; } + + /// + /// Gets or sets key vault uri to access the encryption key. + /// + [JsonProperty(PropertyName = "keyIdentifier")] + public string KeyIdentifier { get; set; } + + /// + /// Gets or sets for future use - The client id of the identity which + /// will be used to access key vault. + /// + [JsonProperty(PropertyName = "identityClientId")] + public string IdentityClientId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KeyVaultArmId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyVaultArmId"); + } + if (KeyIdentifier == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyIdentifier"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelCategory.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelCategory.cs new file mode 100644 index 000000000000..ba77f0ee4170 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelCategory.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Label category definition + /// + public partial class LabelCategory + { + /// + /// Initializes a new instance of the LabelCategory class. + /// + public LabelCategory() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabelCategory class. + /// + /// Indicates whether it is allowed to + /// select multiple classes in this category. + /// Dictionary of label classes in this + /// category. + /// Display name of the label + /// category. + public LabelCategory(bool? allowMultiSelect = default(bool?), IDictionary classes = default(IDictionary), string displayName = default(string)) + { + AllowMultiSelect = allowMultiSelect; + Classes = classes; + DisplayName = displayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether it is allowed to select multiple + /// classes in this category. + /// + [JsonProperty(PropertyName = "allowMultiSelect")] + public bool? AllowMultiSelect { get; set; } + + /// + /// Gets or sets dictionary of label classes in this category. + /// + [JsonProperty(PropertyName = "classes")] + public IDictionary Classes { get; set; } + + /// + /// Gets or sets display name of the label category. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelClass.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelClass.cs new file mode 100644 index 000000000000..d0e599498c5b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelClass.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Label class definition + /// + public partial class LabelClass + { + /// + /// Initializes a new instance of the LabelClass class. + /// + public LabelClass() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabelClass class. + /// + /// Display name of the label class. + /// Dictionary of subclasses of the label + /// class. + public LabelClass(string displayName = default(string), IDictionary subclasses = default(IDictionary)) + { + DisplayName = displayName; + Subclasses = subclasses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets display name of the label class. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets dictionary of subclasses of the label class. + /// + [JsonProperty(PropertyName = "subclasses")] + public IDictionary Subclasses { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingDatasetConfiguration.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingDatasetConfiguration.cs new file mode 100644 index 000000000000..affeedc717d7 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingDatasetConfiguration.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Labeling dataset configuration definition + /// + public partial class LabelingDatasetConfiguration + { + /// + /// Initializes a new instance of the LabelingDatasetConfiguration + /// class. + /// + public LabelingDatasetConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabelingDatasetConfiguration + /// class. + /// + /// Name of the data asset to perform + /// labeling. + /// AML dataset version. + /// Indicates whether to + /// enable incremental dataset refresh. + public LabelingDatasetConfiguration(string assetName = default(string), string datasetVersion = default(string), bool? incrementalDatasetRefreshEnabled = default(bool?)) + { + AssetName = assetName; + DatasetVersion = datasetVersion; + IncrementalDatasetRefreshEnabled = incrementalDatasetRefreshEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the data asset to perform labeling. + /// + [JsonProperty(PropertyName = "assetName")] + public string AssetName { get; set; } + + /// + /// Gets or sets AML dataset version. + /// + [JsonProperty(PropertyName = "datasetVersion")] + public string DatasetVersion { get; set; } + + /// + /// Gets or sets indicates whether to enable incremental dataset + /// refresh. + /// + [JsonProperty(PropertyName = "incrementalDatasetRefreshEnabled")] + public bool? IncrementalDatasetRefreshEnabled { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJob.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJob.cs new file mode 100644 index 000000000000..d6f898fd14a5 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJob.cs @@ -0,0 +1,212 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Labeling job definition + /// + public partial class LabelingJob + { + /// + /// Initializes a new instance of the LabelingJob class. + /// + public LabelingJob() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabelingJob class. + /// + /// Specifies the type of job. This field should + /// always be set to "Labeling". Possible values include: 'Command', + /// 'Sweep', 'Labeling' + /// Created time of the job in UTC + /// timezone. + /// Configuration of dataset used in + /// the job. + /// The asset description text. + /// List of JobEndpoints. + /// For local jobs, a job endpoint will have an endpoint value of + /// FileStreamObject. + /// Labeling instructions of the + /// job. + /// Label categories of the job. + /// Media type specific + /// properties in the job. + /// Configuration of MLAssist + /// feature in the job. + /// Progress metrics of the job. + /// Internal id of the job(Previously called + /// project). + /// The asset property dictionary. + /// Specifies the labeling job + /// provisioning state. Possible values include: 'Succeeded', 'Failed', + /// 'Canceled', 'InProgress' + /// Status of the job. Possible values include: + /// 'NotStarted', 'Starting', 'Provisioning', 'Preparing', 'Queued', + /// 'Running', 'Finalizing', 'CancelRequested', 'Completed', 'Failed', + /// 'Canceled', 'NotResponding', 'Paused', 'Unknown' + /// Status messages of the job. + /// Tag dictionary. Tags can be added, removed, and + /// updated. + public LabelingJob(string jobType, System.DateTime? createdTimeUtc = default(System.DateTime?), LabelingDatasetConfiguration datasetConfiguration = default(LabelingDatasetConfiguration), string description = default(string), IDictionary interactionEndpoints = default(IDictionary), LabelingJobInstructions jobInstructions = default(LabelingJobInstructions), IDictionary labelCategories = default(IDictionary), LabelingJobMediaProperties labelingJobMediaProperties = default(LabelingJobMediaProperties), MLAssistConfiguration mlAssistConfiguration = default(MLAssistConfiguration), ProgressMetrics progressMetrics = default(ProgressMetrics), System.Guid? projectId = default(System.Guid?), IDictionary properties = default(IDictionary), string provisioningState = default(string), string status = default(string), IList statusMessages = default(IList), IDictionary tags = default(IDictionary)) + { + CreatedTimeUtc = createdTimeUtc; + DatasetConfiguration = datasetConfiguration; + Description = description; + InteractionEndpoints = interactionEndpoints; + JobInstructions = jobInstructions; + JobType = jobType; + LabelCategories = labelCategories; + LabelingJobMediaProperties = labelingJobMediaProperties; + MlAssistConfiguration = mlAssistConfiguration; + ProgressMetrics = progressMetrics; + ProjectId = projectId; + Properties = properties; + ProvisioningState = provisioningState; + Status = status; + StatusMessages = statusMessages; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets created time of the job in UTC timezone. + /// + [JsonProperty(PropertyName = "createdTimeUtc")] + public System.DateTime? CreatedTimeUtc { get; private set; } + + /// + /// Gets or sets configuration of dataset used in the job. + /// + [JsonProperty(PropertyName = "datasetConfiguration")] + public LabelingDatasetConfiguration DatasetConfiguration { get; set; } + + /// + /// Gets or sets the asset description text. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets list of JobEndpoints. + /// For local jobs, a job endpoint will have an endpoint value of + /// FileStreamObject. + /// + [JsonProperty(PropertyName = "interactionEndpoints")] + public IDictionary InteractionEndpoints { get; private set; } + + /// + /// Gets or sets labeling instructions of the job. + /// + [JsonProperty(PropertyName = "jobInstructions")] + public LabelingJobInstructions JobInstructions { get; set; } + + /// + /// Gets or sets specifies the type of job. This field should always be + /// set to "Labeling". Possible values include: 'Command', 'Sweep', + /// 'Labeling' + /// + [JsonProperty(PropertyName = "jobType")] + public string JobType { get; set; } + + /// + /// Gets or sets label categories of the job. + /// + [JsonProperty(PropertyName = "labelCategories")] + public IDictionary LabelCategories { get; set; } + + /// + /// Gets or sets media type specific properties in the job. + /// + [JsonProperty(PropertyName = "labelingJobMediaProperties")] + public LabelingJobMediaProperties LabelingJobMediaProperties { get; set; } + + /// + /// Gets or sets configuration of MLAssist feature in the job. + /// + [JsonProperty(PropertyName = "mlAssistConfiguration")] + public MLAssistConfiguration MlAssistConfiguration { get; set; } + + /// + /// Gets progress metrics of the job. + /// + [JsonProperty(PropertyName = "progressMetrics")] + public ProgressMetrics ProgressMetrics { get; private set; } + + /// + /// Gets internal id of the job(Previously called project). + /// + [JsonProperty(PropertyName = "projectId")] + public System.Guid? ProjectId { get; private set; } + + /// + /// Gets or sets the asset property dictionary. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets specifies the labeling job provisioning state. Possible values + /// include: 'Succeeded', 'Failed', 'Canceled', 'InProgress' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets status of the job. Possible values include: 'NotStarted', + /// 'Starting', 'Provisioning', 'Preparing', 'Queued', 'Running', + /// 'Finalizing', 'CancelRequested', 'Completed', 'Failed', 'Canceled', + /// 'NotResponding', 'Paused', 'Unknown' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets status messages of the job. + /// + [JsonProperty(PropertyName = "statusMessages")] + public IList StatusMessages { get; private set; } + + /// + /// Gets or sets tag dictionary. Tags can be added, removed, and + /// updated. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (JobType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "JobType"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobImageProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobImageProperties.cs new file mode 100644 index 000000000000..191dd16229be --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobImageProperties.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a labeling job for image data + /// + [Newtonsoft.Json.JsonObject("Image")] + public partial class LabelingJobImageProperties : LabelingJobMediaProperties + { + /// + /// Initializes a new instance of the LabelingJobImageProperties class. + /// + public LabelingJobImageProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabelingJobImageProperties class. + /// + /// Annotation type of image labeling job. + /// Possible values include: 'Classification', 'BoundingBox', + /// 'InstanceSegmentation' + public LabelingJobImageProperties(string annotationType = default(string)) + { + AnnotationType = annotationType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets annotation type of image labeling job. Possible values + /// include: 'Classification', 'BoundingBox', 'InstanceSegmentation' + /// + [JsonProperty(PropertyName = "annotationType")] + public string AnnotationType { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobInstructions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobInstructions.cs new file mode 100644 index 000000000000..3049b70bb44e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobInstructions.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Instructions for labeling job + /// + public partial class LabelingJobInstructions + { + /// + /// Initializes a new instance of the LabelingJobInstructions class. + /// + public LabelingJobInstructions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabelingJobInstructions class. + /// + /// The link to a page with detailed labeling + /// instructions for labelers. + public LabelingJobInstructions(string uri = default(string)) + { + Uri = uri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the link to a page with detailed labeling instructions + /// for labelers. + /// + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobMediaProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobMediaProperties.cs new file mode 100644 index 000000000000..0721bd580c00 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobMediaProperties.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.Azure.Management.MachineLearningServices.Models +{ + using System.Linq; + + /// + /// Properties of a labeling job + /// + public partial class LabelingJobMediaProperties + { + /// + /// Initializes a new instance of the LabelingJobMediaProperties class. + /// + public LabelingJobMediaProperties() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobResource.cs new file mode 100644 index 000000000000..0b45ff8742a9 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobResource.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Resource Manager resource envelope. + /// + public partial class LabelingJobResource : Resource + { + /// + /// Initializes a new instance of the LabelingJobResource class. + /// + public LabelingJobResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabelingJobResource class. + /// + /// Additional attributes of the + /// entity. + /// 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" + /// System data associated with resource + /// provider + public LabelingJobResource(LabelingJob properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public LabelingJob Properties { get; set; } + + /// + /// Gets system data associated with resource provider + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobTextProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobTextProperties.cs new file mode 100644 index 000000000000..ccfdc4280c5e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobTextProperties.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a labeling job for text data + /// + [Newtonsoft.Json.JsonObject("Text")] + public partial class LabelingJobTextProperties : LabelingJobMediaProperties + { + /// + /// Initializes a new instance of the LabelingJobTextProperties class. + /// + public LabelingJobTextProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabelingJobTextProperties class. + /// + /// Annotation type of text labeling job. + /// Possible values include: 'Classification' + public LabelingJobTextProperties(string annotationType = default(string)) + { + AnnotationType = annotationType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets annotation type of text labeling job. Possible values + /// include: 'Classification' + /// + [JsonProperty(PropertyName = "annotationType")] + public string AnnotationType { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobsCreateOrUpdateHeaders.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobsCreateOrUpdateHeaders.cs new file mode 100644 index 000000000000..50c7a7749f66 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobsCreateOrUpdateHeaders.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for CreateOrUpdate operation. + /// + public partial class LabelingJobsCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the LabelingJobsCreateOrUpdateHeaders + /// class. + /// + public LabelingJobsCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabelingJobsCreateOrUpdateHeaders + /// class. + /// + /// Timeout for the client to + /// use when polling the asynchronous operation. + /// URI to poll for asynchronous + /// operation status. + public LabelingJobsCreateOrUpdateHeaders(System.TimeSpan? xMsAsyncOperationTimeout = default(System.TimeSpan?), string azureAsyncOperation = default(string)) + { + XMsAsyncOperationTimeout = xMsAsyncOperationTimeout; + AzureAsyncOperation = azureAsyncOperation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets timeout for the client to use when polling the + /// asynchronous operation. + /// + [JsonProperty(PropertyName = "x-ms-async-operation-timeout")] + public System.TimeSpan? XMsAsyncOperationTimeout { get; set; } + + /// + /// Gets or sets URI to poll for asynchronous operation status. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobsExportLabelsHeaders.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobsExportLabelsHeaders.cs new file mode 100644 index 000000000000..9fd3685a92ab --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobsExportLabelsHeaders.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for ExportLabels operation. + /// + public partial class LabelingJobsExportLabelsHeaders + { + /// + /// Initializes a new instance of the LabelingJobsExportLabelsHeaders + /// class. + /// + public LabelingJobsExportLabelsHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabelingJobsExportLabelsHeaders + /// class. + /// + /// URI to poll for asynchronous operation + /// result. + /// Duration the client should wait between + /// requests, in seconds. + public LabelingJobsExportLabelsHeaders(string location = default(string), int? retryAfter = default(int?)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URI to poll for asynchronous operation result. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets duration the client should wait between requests, in + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobsResumeHeaders.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobsResumeHeaders.cs new file mode 100644 index 000000000000..83b3ded1e337 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LabelingJobsResumeHeaders.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Resume operation. + /// + public partial class LabelingJobsResumeHeaders + { + /// + /// Initializes a new instance of the LabelingJobsResumeHeaders class. + /// + public LabelingJobsResumeHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabelingJobsResumeHeaders class. + /// + /// URI to poll for asynchronous operation + /// result. + /// Duration the client should wait between + /// requests, in seconds. + public LabelingJobsResumeHeaders(string location = default(string), int? retryAfter = default(int?)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URI to poll for asynchronous operation result. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets duration the client should wait between requests, in + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LinkedInfo.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LinkedInfo.cs new file mode 100644 index 000000000000..b8043077ad6b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LinkedInfo.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about a datastore origin, if linked. + /// + public partial class LinkedInfo + { + /// + /// Initializes a new instance of the LinkedInfo class. + /// + public LinkedInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinkedInfo class. + /// + /// Linked service ID. + /// Linked service resource + /// name. + /// Type of the linked service. Possible values + /// include: 'Synapse' + public LinkedInfo(string linkedId = default(string), string linkedResourceName = default(string), string origin = default(string)) + { + LinkedId = linkedId; + LinkedResourceName = linkedResourceName; + Origin = origin; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets linked service ID. + /// + [JsonProperty(PropertyName = "linkedId")] + public string LinkedId { get; set; } + + /// + /// Gets or sets linked service resource name. + /// + [JsonProperty(PropertyName = "linkedResourceName")] + public string LinkedResourceName { get; set; } + + /// + /// Gets or sets type of the linked service. Possible values include: + /// 'Synapse' + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ListNotebookKeysResult.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ListNotebookKeysResult.cs new file mode 100644 index 000000000000..b8d5558e2cb8 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ListNotebookKeysResult.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ListNotebookKeysResult + { + /// + /// Initializes a new instance of the ListNotebookKeysResult class. + /// + public ListNotebookKeysResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ListNotebookKeysResult class. + /// + public ListNotebookKeysResult(string primaryAccessKey = default(string), string secondaryAccessKey = default(string)) + { + PrimaryAccessKey = primaryAccessKey; + SecondaryAccessKey = secondaryAccessKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "primaryAccessKey")] + public string PrimaryAccessKey { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "secondaryAccessKey")] + public string SecondaryAccessKey { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ListStorageAccountKeysResult.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ListStorageAccountKeysResult.cs new file mode 100644 index 000000000000..3ad9d4feaad9 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ListStorageAccountKeysResult.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ListStorageAccountKeysResult + { + /// + /// Initializes a new instance of the ListStorageAccountKeysResult + /// class. + /// + public ListStorageAccountKeysResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ListStorageAccountKeysResult + /// class. + /// + public ListStorageAccountKeysResult(string userStorageKey = default(string)) + { + UserStorageKey = userStorageKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "userStorageKey")] + public string UserStorageKey { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ListWorkspaceKeysResult.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ListWorkspaceKeysResult.cs new file mode 100644 index 000000000000..c1afaaa764dc --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ListWorkspaceKeysResult.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ListWorkspaceKeysResult + { + /// + /// Initializes a new instance of the ListWorkspaceKeysResult class. + /// + public ListWorkspaceKeysResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ListWorkspaceKeysResult class. + /// + public ListWorkspaceKeysResult(string userStorageKey = default(string), string userStorageResourceId = default(string), string appInsightsInstrumentationKey = default(string), RegistryListCredentialsResult containerRegistryCredentials = default(RegistryListCredentialsResult), ListNotebookKeysResult notebookAccessKeys = default(ListNotebookKeysResult)) + { + UserStorageKey = userStorageKey; + UserStorageResourceId = userStorageResourceId; + AppInsightsInstrumentationKey = appInsightsInstrumentationKey; + ContainerRegistryCredentials = containerRegistryCredentials; + NotebookAccessKeys = notebookAccessKeys; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "userStorageKey")] + public string UserStorageKey { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "userStorageResourceId")] + public string UserStorageResourceId { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "appInsightsInstrumentationKey")] + public string AppInsightsInstrumentationKey { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "containerRegistryCredentials")] + public RegistryListCredentialsResult ContainerRegistryCredentials { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "notebookAccessKeys")] + public ListNotebookKeysResult NotebookAccessKeys { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LoadBalancerType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LoadBalancerType.cs new file mode 100644 index 000000000000..20a1c9c0e1b7 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/LoadBalancerType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for LoadBalancerType. + /// + public static class LoadBalancerType + { + public const string PublicIp = "PublicIp"; + public const string InternalLoadBalancer = "InternalLoadBalancer"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/MLAssistConfiguration.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/MLAssistConfiguration.cs new file mode 100644 index 000000000000..d3c3fe0e5fc4 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/MLAssistConfiguration.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Labeling MLAssist configuration definition + /// + public partial class MLAssistConfiguration + { + /// + /// Initializes a new instance of the MLAssistConfiguration class. + /// + public MLAssistConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MLAssistConfiguration class. + /// + /// AML compute binding used in + /// inferencing. + /// Indicates whether MLAssist feature is + /// enabled. + /// AML compute binding used in + /// training. + public MLAssistConfiguration(ComputeConfiguration inferencingComputeBinding = default(ComputeConfiguration), bool? mlAssistEnabled = default(bool?), ComputeConfiguration trainingComputeBinding = default(ComputeConfiguration)) + { + InferencingComputeBinding = inferencingComputeBinding; + MlAssistEnabled = mlAssistEnabled; + TrainingComputeBinding = trainingComputeBinding; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets AML compute binding used in inferencing. + /// + [JsonProperty(PropertyName = "inferencingComputeBinding")] + public ComputeConfiguration InferencingComputeBinding { get; set; } + + /// + /// Gets or sets indicates whether MLAssist feature is enabled. + /// + [JsonProperty(PropertyName = "mlAssistEnabled")] + public bool? MlAssistEnabled { get; set; } + + /// + /// Gets or sets AML compute binding used in training. + /// + [JsonProperty(PropertyName = "trainingComputeBinding")] + public ComputeConfiguration TrainingComputeBinding { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ManagedIdentity.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ManagedIdentity.cs new file mode 100644 index 000000000000..f5a515cd7f3b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ManagedIdentity.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Managed identity configuration. + /// + [Newtonsoft.Json.JsonObject("Managed")] + public partial class ManagedIdentity : IdentityConfiguration + { + /// + /// Initializes a new instance of the ManagedIdentity class. + /// + public ManagedIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedIdentity class. + /// + /// Specifies a user-assigned identity by client + /// ID. For system-assigned, do not set this field. + /// Specifies a user-assigned identity by object + /// ID. For system-assigned, do not set this field. + /// Specifies a user-assigned identity by ARM + /// resource ID. For system-assigned, do not set this field. + public ManagedIdentity(System.Guid? clientId = default(System.Guid?), System.Guid? objectId = default(System.Guid?), string resourceId = default(string)) + { + ClientId = clientId; + ObjectId = objectId; + ResourceId = resourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies a user-assigned identity by client ID. For + /// system-assigned, do not set this field. + /// + [JsonProperty(PropertyName = "clientId")] + public System.Guid? ClientId { get; set; } + + /// + /// Gets or sets specifies a user-assigned identity by object ID. For + /// system-assigned, do not set this field. + /// + [JsonProperty(PropertyName = "objectId")] + public System.Guid? ObjectId { get; set; } + + /// + /// Gets or sets specifies a user-assigned identity by ARM resource ID. + /// For system-assigned, do not set this field. + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ManagedOnlineDeployment.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ManagedOnlineDeployment.cs new file mode 100644 index 000000000000..2ea53276a864 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ManagedOnlineDeployment.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + [Newtonsoft.Json.JsonObject("Managed")] + public partial class ManagedOnlineDeployment : OnlineDeployment + { + /// + /// Initializes a new instance of the ManagedOnlineDeployment class. + /// + public ManagedOnlineDeployment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedOnlineDeployment class. + /// + /// If true, enables Application + /// Insights logging. + /// Code configuration for the endpoint + /// deployment. + /// Description of the endpoint + /// deployment. + /// ARM resource ID of the environment + /// specification for the endpoint deployment. + /// Environment variables + /// configuration for the deployment. + /// Deployment container liveness/readiness + /// probe configuration. + /// Reference to the model asset for the endpoint + /// deployment. + /// Property dictionary. Properties can be + /// added, but not removed or altered. + /// Provisioning state for the endpoint + /// deployment. Possible values include: 'Creating', 'Deleting', + /// 'Scaling', 'Updating', 'Succeeded', 'Failed', 'Canceled' + /// Online deployment scoring requests + /// configuration. + /// Online deployment scaling + /// configuration. + /// Compute instance type. + /// Deployment container + /// liveness/readiness probe configuration. + public ManagedOnlineDeployment(bool? appInsightsEnabled = default(bool?), CodeConfiguration codeConfiguration = default(CodeConfiguration), string description = default(string), string environmentId = default(string), IDictionary environmentVariables = default(IDictionary), ProbeSettings livenessProbe = default(ProbeSettings), AssetReferenceBase model = default(AssetReferenceBase), IDictionary properties = default(IDictionary), string provisioningState = default(string), OnlineRequestSettings requestSettings = default(OnlineRequestSettings), OnlineScaleSettings scaleSettings = default(OnlineScaleSettings), string instanceType = default(string), ProbeSettings readinessProbe = default(ProbeSettings)) + : base(appInsightsEnabled, codeConfiguration, description, environmentId, environmentVariables, livenessProbe, model, properties, provisioningState, requestSettings, scaleSettings) + { + InstanceType = instanceType; + ReadinessProbe = readinessProbe; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets compute instance type. + /// + [JsonProperty(PropertyName = "instanceType")] + public string InstanceType { get; set; } + + /// + /// Gets or sets deployment container liveness/readiness probe + /// configuration. + /// + [JsonProperty(PropertyName = "readinessProbe")] + public ProbeSettings ReadinessProbe { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ManualScaleSettings.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ManualScaleSettings.cs new file mode 100644 index 000000000000..5f9701b8c0e0 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ManualScaleSettings.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + [Newtonsoft.Json.JsonObject("Manual")] + public partial class ManualScaleSettings : OnlineScaleSettings + { + /// + /// Initializes a new instance of the ManualScaleSettings class. + /// + public ManualScaleSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManualScaleSettings class. + /// + /// Maximum number of instances for this + /// deployment. + /// Minimum number of instances for this + /// deployment. + /// Fixed number of instances for this + /// deployment. + public ManualScaleSettings(int? maxInstances = default(int?), int? minInstances = default(int?), int? instanceCount = default(int?)) + : base(maxInstances, minInstances) + { + InstanceCount = instanceCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets fixed number of instances for this deployment. + /// + [JsonProperty(PropertyName = "instanceCount")] + public int? InstanceCount { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/MediaType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/MediaType.cs new file mode 100644 index 000000000000..5c8dcfda2342 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/MediaType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for MediaType. + /// + public static class MediaType + { + public const string Image = "Image"; + public const string Text = "Text"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/MedianStoppingPolicy.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/MedianStoppingPolicy.cs new file mode 100644 index 000000000000..b13c08c3dfa9 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/MedianStoppingPolicy.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines an early termination policy based on running averages of the + /// primary metric of all runs. + /// + [Newtonsoft.Json.JsonObject("MedianStopping")] + public partial class MedianStoppingPolicy : EarlyTerminationPolicy + { + /// + /// Initializes a new instance of the MedianStoppingPolicy class. + /// + public MedianStoppingPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MedianStoppingPolicy class. + /// + /// Number of intervals by which to delay + /// the first evaluation. + /// Interval (number of runs) between + /// policy evaluations. + public MedianStoppingPolicy(int? delayEvaluation = default(int?), int? evaluationInterval = default(int?)) + : base(delayEvaluation, evaluationInterval) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ModelContainer.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ModelContainer.cs new file mode 100644 index 000000000000..69ab40f69193 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ModelContainer.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class ModelContainer + { + /// + /// Initializes a new instance of the ModelContainer class. + /// + public ModelContainer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ModelContainer class. + /// + /// The asset description text. + /// The asset property dictionary. + /// Tag dictionary. Tags can be added, removed, and + /// updated. + public ModelContainer(string description = default(string), IDictionary properties = default(IDictionary), IDictionary tags = default(IDictionary)) + { + Description = description; + Properties = properties; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the asset description text. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the asset property dictionary. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets or sets tag dictionary. Tags can be added, removed, and + /// updated. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ModelContainerResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ModelContainerResource.cs new file mode 100644 index 000000000000..d1ecc74e3b59 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ModelContainerResource.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Resource Manager resource envelope. + /// + public partial class ModelContainerResource : Resource + { + /// + /// Initializes a new instance of the ModelContainerResource class. + /// + public ModelContainerResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ModelContainerResource class. + /// + /// Additional attributes of the + /// entity. + /// 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" + /// System data associated with resource + /// provider + public ModelContainerResource(ModelContainer properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public ModelContainer Properties { get; set; } + + /// + /// Gets system data associated with resource provider + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ModelVersion.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ModelVersion.cs new file mode 100644 index 000000000000..4e78c6b7e2e2 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ModelVersion.cs @@ -0,0 +1,130 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Model asset version details. + /// + public partial class ModelVersion + { + /// + /// Initializes a new instance of the ModelVersion class. + /// + public ModelVersion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ModelVersion class. + /// + /// The path of the file/directory in the + /// datastore. + /// ARM resource ID of the datastore where + /// the asset is located. + /// The asset description text. + /// Mapping of model flavors to their + /// properties. + /// If the name version are system generated + /// (anonymous registration). + /// The asset property dictionary. + /// Tag dictionary. Tags can be added, removed, and + /// updated. + public ModelVersion(string path, string datastoreId = default(string), string description = default(string), IDictionary flavors = default(IDictionary), bool? isAnonymous = default(bool?), IDictionary properties = default(IDictionary), IDictionary tags = default(IDictionary)) + { + DatastoreId = datastoreId; + Description = description; + Flavors = flavors; + IsAnonymous = isAnonymous; + Path = path; + Properties = properties; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ARM resource ID of the datastore where the asset is + /// located. + /// + [JsonProperty(PropertyName = "datastoreId")] + public string DatastoreId { get; set; } + + /// + /// Gets or sets the asset description text. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets mapping of model flavors to their properties. + /// + [JsonProperty(PropertyName = "flavors")] + public IDictionary Flavors { get; set; } + + /// + /// Gets or sets if the name version are system generated (anonymous + /// registration). + /// + [JsonProperty(PropertyName = "isAnonymous")] + public bool? IsAnonymous { get; set; } + + /// + /// Gets or sets the path of the file/directory in the datastore. + /// + [JsonProperty(PropertyName = "path")] + public string Path { get; set; } + + /// + /// Gets or sets the asset property dictionary. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets or sets tag dictionary. Tags can be added, removed, and + /// updated. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Path == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Path"); + } + if (Path != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Path, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Path", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ModelVersionResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ModelVersionResource.cs new file mode 100644 index 000000000000..dded38d243bd --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ModelVersionResource.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Resource Manager resource envelope. + /// + public partial class ModelVersionResource : Resource + { + /// + /// Initializes a new instance of the ModelVersionResource class. + /// + public ModelVersionResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ModelVersionResource class. + /// + /// Additional attributes of the + /// entity. + /// 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" + /// System data associated with resource + /// provider + public ModelVersionResource(ModelVersion properties, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public ModelVersion Properties { get; set; } + + /// + /// Gets system data associated with resource provider + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Mpi.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Mpi.cs new file mode 100644 index 000000000000..e25dfa83c0e5 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Mpi.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// MPI distribution configuration. + /// + public partial class Mpi : DistributionConfiguration + { + /// + /// Initializes a new instance of the Mpi class. + /// + public Mpi() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Mpi class. + /// + /// Number of processes per MPI + /// node. + public Mpi(int? processCountPerInstance = default(int?)) + { + ProcessCountPerInstance = processCountPerInstance; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets number of processes per MPI node. + /// + [JsonProperty(PropertyName = "processCountPerInstance")] + public int? ProcessCountPerInstance { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NodeState.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NodeState.cs new file mode 100644 index 000000000000..0bb7f549ceb5 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NodeState.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for NodeState. + /// + public static class NodeState + { + public const string Idle = "idle"; + public const string Running = "running"; + public const string Preparing = "preparing"; + public const string Unusable = "unusable"; + public const string Leaving = "leaving"; + public const string Preempted = "preempted"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NodeStateCounts.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NodeStateCounts.cs new file mode 100644 index 000000000000..20f2be1e2911 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NodeStateCounts.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Counts of various compute node states on the amlCompute. + /// + public partial class NodeStateCounts + { + /// + /// Initializes a new instance of the NodeStateCounts class. + /// + public NodeStateCounts() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NodeStateCounts class. + /// + /// Idle node count. + /// Running node count. + /// Preparing node count. + /// Unusable node count. + /// Leaving node count. + /// Preempted node count. + public NodeStateCounts(int? idleNodeCount = default(int?), int? runningNodeCount = default(int?), int? preparingNodeCount = default(int?), int? unusableNodeCount = default(int?), int? leavingNodeCount = default(int?), int? preemptedNodeCount = default(int?)) + { + IdleNodeCount = idleNodeCount; + RunningNodeCount = runningNodeCount; + PreparingNodeCount = preparingNodeCount; + UnusableNodeCount = unusableNodeCount; + LeavingNodeCount = leavingNodeCount; + PreemptedNodeCount = preemptedNodeCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets idle node count. + /// + /// + /// Number of compute nodes in idle state. + /// + [JsonProperty(PropertyName = "idleNodeCount")] + public int? IdleNodeCount { get; private set; } + + /// + /// Gets running node count. + /// + /// + /// Number of compute nodes which are running jobs. + /// + [JsonProperty(PropertyName = "runningNodeCount")] + public int? RunningNodeCount { get; private set; } + + /// + /// Gets preparing node count. + /// + /// + /// Number of compute nodes which are being prepared. + /// + [JsonProperty(PropertyName = "preparingNodeCount")] + public int? PreparingNodeCount { get; private set; } + + /// + /// Gets unusable node count. + /// + /// + /// Number of compute nodes which are in unusable state. + /// + [JsonProperty(PropertyName = "unusableNodeCount")] + public int? UnusableNodeCount { get; private set; } + + /// + /// Gets leaving node count. + /// + /// + /// Number of compute nodes which are leaving the amlCompute. + /// + [JsonProperty(PropertyName = "leavingNodeCount")] + public int? LeavingNodeCount { get; private set; } + + /// + /// Gets preempted node count. + /// + /// + /// Number of compute nodes which are in preempted state. + /// + [JsonProperty(PropertyName = "preemptedNodeCount")] + public int? PreemptedNodeCount { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NoneDatastoreCredentials.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NoneDatastoreCredentials.cs new file mode 100644 index 000000000000..b0d21ef31e34 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NoneDatastoreCredentials.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Empty/none datastore credentials. + /// + [Newtonsoft.Json.JsonObject("None")] + public partial class NoneDatastoreCredentials : DatastoreCredentials + { + /// + /// Initializes a new instance of the NoneDatastoreCredentials class. + /// + public NoneDatastoreCredentials() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NoneDatastoreCredentials class. + /// + /// Empty/none datastore secret. + public NoneDatastoreCredentials(NoneDatastoreSecrets secrets = default(NoneDatastoreSecrets)) + { + Secrets = secrets; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets empty/none datastore secret. + /// + [JsonProperty(PropertyName = "secrets")] + public NoneDatastoreSecrets Secrets { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NoneDatastoreSecrets.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NoneDatastoreSecrets.cs new file mode 100644 index 000000000000..a1bf414bc76c --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NoneDatastoreSecrets.cs @@ -0,0 +1,37 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Empty/none datastore secret. + /// + [Newtonsoft.Json.JsonObject("None")] + public partial class NoneDatastoreSecrets : DatastoreSecrets + { + /// + /// Initializes a new instance of the NoneDatastoreSecrets class. + /// + public NoneDatastoreSecrets() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NotebookAccessTokenResult.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NotebookAccessTokenResult.cs new file mode 100644 index 000000000000..e6c71ff96fdf --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NotebookAccessTokenResult.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class NotebookAccessTokenResult + { + /// + /// Initializes a new instance of the NotebookAccessTokenResult class. + /// + public NotebookAccessTokenResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotebookAccessTokenResult class. + /// + public NotebookAccessTokenResult(string notebookResourceId = default(string), string hostName = default(string), string publicDns = default(string), string accessToken = default(string), string tokenType = default(string), int? expiresIn = default(int?), string refreshToken = default(string), string scope = default(string)) + { + NotebookResourceId = notebookResourceId; + HostName = hostName; + PublicDns = publicDns; + AccessToken = accessToken; + TokenType = tokenType; + ExpiresIn = expiresIn; + RefreshToken = refreshToken; + Scope = scope; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "notebookResourceId")] + public string NotebookResourceId { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "hostName")] + public string HostName { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "publicDns")] + public string PublicDns { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "accessToken")] + public string AccessToken { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "tokenType")] + public string TokenType { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "expiresIn")] + public int? ExpiresIn { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "refreshToken")] + public string RefreshToken { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "scope")] + public string Scope { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NotebookPreparationError.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NotebookPreparationError.cs new file mode 100644 index 000000000000..35182f23db9b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NotebookPreparationError.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class NotebookPreparationError + { + /// + /// Initializes a new instance of the NotebookPreparationError class. + /// + public NotebookPreparationError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotebookPreparationError class. + /// + public NotebookPreparationError(string errorMessage = default(string), int? statusCode = default(int?)) + { + ErrorMessage = errorMessage; + StatusCode = statusCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "errorMessage")] + public string ErrorMessage { get; set; } + + /// + /// + [JsonProperty(PropertyName = "statusCode")] + public int? StatusCode { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NotebookResourceInfo.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NotebookResourceInfo.cs new file mode 100644 index 000000000000..cc95f0ae282b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/NotebookResourceInfo.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class NotebookResourceInfo + { + /// + /// Initializes a new instance of the NotebookResourceInfo class. + /// + public NotebookResourceInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NotebookResourceInfo class. + /// + /// the data plane resourceId that used to + /// initialize notebook component + /// The error that occurs when + /// preparing notebook. + public NotebookResourceInfo(string fqdn = default(string), string resourceId = default(string), NotebookPreparationError notebookPreparationError = default(NotebookPreparationError)) + { + Fqdn = fqdn; + ResourceId = resourceId; + NotebookPreparationError = notebookPreparationError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "fqdn")] + public string Fqdn { get; set; } + + /// + /// Gets or sets the data plane resourceId that used to initialize + /// notebook component + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets or sets the error that occurs when preparing notebook. + /// + [JsonProperty(PropertyName = "notebookPreparationError")] + public NotebookPreparationError NotebookPreparationError { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Objective.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Objective.cs new file mode 100644 index 000000000000..76837d6b9fba --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Objective.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Optimization objective. + /// + public partial class Objective + { + /// + /// Initializes a new instance of the Objective class. + /// + public Objective() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Objective class. + /// + /// Defines supported metric goals for + /// hyperparameter tuning. Possible values include: 'Minimize', + /// 'Maximize' + /// Name of the metric to optimize. + public Objective(string goal, string primaryMetric) + { + Goal = goal; + PrimaryMetric = primaryMetric; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets defines supported metric goals for hyperparameter + /// tuning. Possible values include: 'Minimize', 'Maximize' + /// + [JsonProperty(PropertyName = "goal")] + public string Goal { get; set; } + + /// + /// Gets or sets name of the metric to optimize. + /// + [JsonProperty(PropertyName = "primaryMetric")] + public string PrimaryMetric { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Goal == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Goal"); + } + if (PrimaryMetric == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrimaryMetric"); + } + if (PrimaryMetric != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(PrimaryMetric, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "PrimaryMetric", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineDeployment.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineDeployment.cs new file mode 100644 index 000000000000..470cb901005c --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineDeployment.cs @@ -0,0 +1,162 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class OnlineDeployment + { + /// + /// Initializes a new instance of the OnlineDeployment class. + /// + public OnlineDeployment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OnlineDeployment class. + /// + /// If true, enables Application + /// Insights logging. + /// Code configuration for the endpoint + /// deployment. + /// Description of the endpoint + /// deployment. + /// ARM resource ID of the environment + /// specification for the endpoint deployment. + /// Environment variables + /// configuration for the deployment. + /// Deployment container liveness/readiness + /// probe configuration. + /// Reference to the model asset for the endpoint + /// deployment. + /// Property dictionary. Properties can be + /// added, but not removed or altered. + /// Provisioning state for the endpoint + /// deployment. Possible values include: 'Creating', 'Deleting', + /// 'Scaling', 'Updating', 'Succeeded', 'Failed', 'Canceled' + /// Online deployment scoring requests + /// configuration. + /// Online deployment scaling + /// configuration. + public OnlineDeployment(bool? appInsightsEnabled = default(bool?), CodeConfiguration codeConfiguration = default(CodeConfiguration), string description = default(string), string environmentId = default(string), IDictionary environmentVariables = default(IDictionary), ProbeSettings livenessProbe = default(ProbeSettings), AssetReferenceBase model = default(AssetReferenceBase), IDictionary properties = default(IDictionary), string provisioningState = default(string), OnlineRequestSettings requestSettings = default(OnlineRequestSettings), OnlineScaleSettings scaleSettings = default(OnlineScaleSettings)) + { + AppInsightsEnabled = appInsightsEnabled; + CodeConfiguration = codeConfiguration; + Description = description; + EnvironmentId = environmentId; + EnvironmentVariables = environmentVariables; + LivenessProbe = livenessProbe; + Model = model; + Properties = properties; + ProvisioningState = provisioningState; + RequestSettings = requestSettings; + ScaleSettings = scaleSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets if true, enables Application Insights logging. + /// + [JsonProperty(PropertyName = "appInsightsEnabled")] + public bool? AppInsightsEnabled { get; set; } + + /// + /// Gets or sets code configuration for the endpoint deployment. + /// + [JsonProperty(PropertyName = "codeConfiguration")] + public CodeConfiguration CodeConfiguration { get; set; } + + /// + /// Gets or sets description of the endpoint deployment. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets ARM resource ID of the environment specification for + /// the endpoint deployment. + /// + [JsonProperty(PropertyName = "environmentId")] + public string EnvironmentId { get; set; } + + /// + /// Gets or sets environment variables configuration for the + /// deployment. + /// + [JsonProperty(PropertyName = "environmentVariables")] + public IDictionary EnvironmentVariables { get; set; } + + /// + /// Gets or sets deployment container liveness/readiness probe + /// configuration. + /// + [JsonProperty(PropertyName = "livenessProbe")] + public ProbeSettings LivenessProbe { get; set; } + + /// + /// Gets or sets reference to the model asset for the endpoint + /// deployment. + /// + [JsonProperty(PropertyName = "model")] + public AssetReferenceBase Model { get; set; } + + /// + /// Gets or sets property dictionary. Properties can be added, but not + /// removed or altered. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets provisioning state for the endpoint deployment. Possible + /// values include: 'Creating', 'Deleting', 'Scaling', 'Updating', + /// 'Succeeded', 'Failed', 'Canceled' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets online deployment scoring requests configuration. + /// + [JsonProperty(PropertyName = "requestSettings")] + public OnlineRequestSettings RequestSettings { get; set; } + + /// + /// Gets or sets online deployment scaling configuration. + /// + [JsonProperty(PropertyName = "scaleSettings")] + public OnlineScaleSettings ScaleSettings { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CodeConfiguration != null) + { + CodeConfiguration.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineDeploymentTrackedResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineDeploymentTrackedResource.cs new file mode 100644 index 000000000000..049be55d864d --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineDeploymentTrackedResource.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class OnlineDeploymentTrackedResource : TrackedResource + { + /// + /// Initializes a new instance of the OnlineDeploymentTrackedResource + /// class. + /// + public OnlineDeploymentTrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OnlineDeploymentTrackedResource + /// class. + /// + /// The geo-location where the resource + /// lives + /// Additional attributes of the + /// entity. + /// 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" + /// Resource tags. + /// Service identity associated with a + /// resource. + /// Metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// System data associated with resource + /// provider + public OnlineDeploymentTrackedResource(string location, OnlineDeployment properties, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentity identity = default(ResourceIdentity), string kind = default(string), SystemData systemData = default(SystemData)) + : base(location, id, name, type, tags) + { + Identity = identity; + Kind = kind; + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service identity associated with a resource. + /// + [JsonProperty(PropertyName = "identity")] + public ResourceIdentity Identity { get; set; } + + /// + /// Gets or sets metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public OnlineDeployment Properties { get; set; } + + /// + /// Gets system data associated with resource provider + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineDeploymentsCreateOrUpdateHeaders.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineDeploymentsCreateOrUpdateHeaders.cs new file mode 100644 index 000000000000..472f11dae694 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineDeploymentsCreateOrUpdateHeaders.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for CreateOrUpdate operation. + /// + public partial class OnlineDeploymentsCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the + /// OnlineDeploymentsCreateOrUpdateHeaders class. + /// + public OnlineDeploymentsCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// OnlineDeploymentsCreateOrUpdateHeaders class. + /// + /// Timeout for the client to + /// use when polling the asynchronous operation. + /// URI to poll for asynchronous + /// operation status. + public OnlineDeploymentsCreateOrUpdateHeaders(System.TimeSpan? xMsAsyncOperationTimeout = default(System.TimeSpan?), string azureAsyncOperation = default(string)) + { + XMsAsyncOperationTimeout = xMsAsyncOperationTimeout; + AzureAsyncOperation = azureAsyncOperation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets timeout for the client to use when polling the + /// asynchronous operation. + /// + [JsonProperty(PropertyName = "x-ms-async-operation-timeout")] + public System.TimeSpan? XMsAsyncOperationTimeout { get; set; } + + /// + /// Gets or sets URI to poll for asynchronous operation status. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineDeploymentsDeleteHeaders.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineDeploymentsDeleteHeaders.cs new file mode 100644 index 000000000000..cd118e508b36 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineDeploymentsDeleteHeaders.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class OnlineDeploymentsDeleteHeaders + { + /// + /// Initializes a new instance of the OnlineDeploymentsDeleteHeaders + /// class. + /// + public OnlineDeploymentsDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OnlineDeploymentsDeleteHeaders + /// class. + /// + /// Timeout for the client to + /// use when polling the asynchronous operation. + /// URI to poll for asynchronous operation + /// result. + /// Duration the client should wait between + /// requests, in seconds. + public OnlineDeploymentsDeleteHeaders(System.TimeSpan? xMsAsyncOperationTimeout = default(System.TimeSpan?), string location = default(string), int? retryAfter = default(int?)) + { + XMsAsyncOperationTimeout = xMsAsyncOperationTimeout; + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets timeout for the client to use when polling the + /// asynchronous operation. + /// + [JsonProperty(PropertyName = "x-ms-async-operation-timeout")] + public System.TimeSpan? XMsAsyncOperationTimeout { get; set; } + + /// + /// Gets or sets URI to poll for asynchronous operation result. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets duration the client should wait between requests, in + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineDeploymentsUpdateHeaders.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineDeploymentsUpdateHeaders.cs new file mode 100644 index 000000000000..c64c407fc039 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineDeploymentsUpdateHeaders.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class OnlineDeploymentsUpdateHeaders + { + /// + /// Initializes a new instance of the OnlineDeploymentsUpdateHeaders + /// class. + /// + public OnlineDeploymentsUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OnlineDeploymentsUpdateHeaders + /// class. + /// + /// Timeout for the client to + /// use when polling the asynchronous operation. + /// URI to poll for asynchronous operation + /// result. + /// Duration the client should wait between + /// requests, in seconds. + public OnlineDeploymentsUpdateHeaders(System.TimeSpan? xMsAsyncOperationTimeout = default(System.TimeSpan?), string location = default(string), int? retryAfter = default(int?)) + { + XMsAsyncOperationTimeout = xMsAsyncOperationTimeout; + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets timeout for the client to use when polling the + /// asynchronous operation. + /// + [JsonProperty(PropertyName = "x-ms-async-operation-timeout")] + public System.TimeSpan? XMsAsyncOperationTimeout { get; set; } + + /// + /// Gets or sets URI to poll for asynchronous operation result. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets duration the client should wait between requests, in + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpoint.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpoint.cs new file mode 100644 index 000000000000..0fdb02e07826 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpoint.cs @@ -0,0 +1,149 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Online endpoint configuration + /// + public partial class OnlineEndpoint + { + /// + /// Initializes a new instance of the OnlineEndpoint class. + /// + public OnlineEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OnlineEndpoint class. + /// + /// Inference endpoint authentication mode type. + /// Possible values include: 'AMLToken', 'Key', 'AADToken' + /// Description of the inference + /// endpoint. + /// EndpointAuthKeys to set initially on an + /// Endpoint. + /// This property will always be returned as null. AuthKey values must + /// be retrieved using the ListKeys API. + /// Property dictionary. Properties can be + /// added, but not removed or altered. + /// State of endpoint provisioning. + /// Possible values include: 'Creating', 'Deleting', 'Succeeded', + /// 'Failed', 'Updating', 'Canceled' + /// Endpoint URI. + /// Endpoint Swagger URI. + /// ARM resource ID of the compute if it exists. + /// optional + /// Traffic rules on how the traffic will be + /// routed across deployments. + public OnlineEndpoint(string authMode, string description = default(string), EndpointAuthKeys keys = default(EndpointAuthKeys), IDictionary properties = default(IDictionary), string provisioningState = default(string), string scoringUri = default(string), string swaggerUri = default(string), string target = default(string), IDictionary traffic = default(IDictionary)) + { + AuthMode = authMode; + Description = description; + Keys = keys; + Properties = properties; + ProvisioningState = provisioningState; + ScoringUri = scoringUri; + SwaggerUri = swaggerUri; + Target = target; + Traffic = traffic; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets inference endpoint authentication mode type. Possible + /// values include: 'AMLToken', 'Key', 'AADToken' + /// + [JsonProperty(PropertyName = "authMode")] + public string AuthMode { get; set; } + + /// + /// Gets or sets description of the inference endpoint. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets endpointAuthKeys to set initially on an Endpoint. + /// This property will always be returned as null. AuthKey values must + /// be retrieved using the ListKeys API. + /// + [JsonProperty(PropertyName = "keys")] + public EndpointAuthKeys Keys { get; set; } + + /// + /// Gets or sets property dictionary. Properties can be added, but not + /// removed or altered. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// Gets state of endpoint provisioning. Possible values include: + /// 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Updating', + /// 'Canceled' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets endpoint URI. + /// + [JsonProperty(PropertyName = "scoringUri")] + public string ScoringUri { get; private set; } + + /// + /// Gets endpoint Swagger URI. + /// + [JsonProperty(PropertyName = "swaggerUri")] + public string SwaggerUri { get; private set; } + + /// + /// Gets or sets ARM resource ID of the compute if it exists. + /// optional + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + /// + /// Gets or sets traffic rules on how the traffic will be routed across + /// deployments. + /// + [JsonProperty(PropertyName = "traffic")] + public IDictionary Traffic { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AuthMode == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AuthMode"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpointTrackedResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpointTrackedResource.cs new file mode 100644 index 000000000000..881e6d4bb851 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpointTrackedResource.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class OnlineEndpointTrackedResource : TrackedResource + { + /// + /// Initializes a new instance of the OnlineEndpointTrackedResource + /// class. + /// + public OnlineEndpointTrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OnlineEndpointTrackedResource + /// class. + /// + /// The geo-location where the resource + /// lives + /// Additional attributes of the + /// entity. + /// 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" + /// Resource tags. + /// Service identity associated with a + /// resource. + /// Metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// System data associated with resource + /// provider + public OnlineEndpointTrackedResource(string location, OnlineEndpoint properties, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentity identity = default(ResourceIdentity), string kind = default(string), SystemData systemData = default(SystemData)) + : base(location, id, name, type, tags) + { + Identity = identity; + Kind = kind; + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service identity associated with a resource. + /// + [JsonProperty(PropertyName = "identity")] + public ResourceIdentity Identity { get; set; } + + /// + /// Gets or sets metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public OnlineEndpoint Properties { get; set; } + + /// + /// Gets system data associated with resource provider + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpointsCreateOrUpdateHeaders.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpointsCreateOrUpdateHeaders.cs new file mode 100644 index 000000000000..0470a6d73097 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpointsCreateOrUpdateHeaders.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for CreateOrUpdate operation. + /// + public partial class OnlineEndpointsCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the + /// OnlineEndpointsCreateOrUpdateHeaders class. + /// + public OnlineEndpointsCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// OnlineEndpointsCreateOrUpdateHeaders class. + /// + /// Timeout for the client to + /// use when polling the asynchronous operation. + /// URI to poll for asynchronous + /// operation status. + public OnlineEndpointsCreateOrUpdateHeaders(System.TimeSpan? xMsAsyncOperationTimeout = default(System.TimeSpan?), string azureAsyncOperation = default(string)) + { + XMsAsyncOperationTimeout = xMsAsyncOperationTimeout; + AzureAsyncOperation = azureAsyncOperation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets timeout for the client to use when polling the + /// asynchronous operation. + /// + [JsonProperty(PropertyName = "x-ms-async-operation-timeout")] + public System.TimeSpan? XMsAsyncOperationTimeout { get; set; } + + /// + /// Gets or sets URI to poll for asynchronous operation status. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpointsDeleteHeaders.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpointsDeleteHeaders.cs new file mode 100644 index 000000000000..35d252861681 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpointsDeleteHeaders.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class OnlineEndpointsDeleteHeaders + { + /// + /// Initializes a new instance of the OnlineEndpointsDeleteHeaders + /// class. + /// + public OnlineEndpointsDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OnlineEndpointsDeleteHeaders + /// class. + /// + /// Timeout for the client to + /// use when polling the asynchronous operation. + /// URI to poll for asynchronous operation + /// result. + /// Duration the client should wait between + /// requests, in seconds. + public OnlineEndpointsDeleteHeaders(System.TimeSpan? xMsAsyncOperationTimeout = default(System.TimeSpan?), string location = default(string), int? retryAfter = default(int?)) + { + XMsAsyncOperationTimeout = xMsAsyncOperationTimeout; + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets timeout for the client to use when polling the + /// asynchronous operation. + /// + [JsonProperty(PropertyName = "x-ms-async-operation-timeout")] + public System.TimeSpan? XMsAsyncOperationTimeout { get; set; } + + /// + /// Gets or sets URI to poll for asynchronous operation result. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets duration the client should wait between requests, in + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpointsRegenerateKeysHeaders.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpointsRegenerateKeysHeaders.cs new file mode 100644 index 000000000000..758f82c50d52 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpointsRegenerateKeysHeaders.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for RegenerateKeys operation. + /// + public partial class OnlineEndpointsRegenerateKeysHeaders + { + /// + /// Initializes a new instance of the + /// OnlineEndpointsRegenerateKeysHeaders class. + /// + public OnlineEndpointsRegenerateKeysHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// OnlineEndpointsRegenerateKeysHeaders class. + /// + /// URI to poll for asynchronous operation + /// result. + /// Duration the client should wait between + /// requests, in seconds. + public OnlineEndpointsRegenerateKeysHeaders(string location = default(string), int? retryAfter = default(int?)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URI to poll for asynchronous operation result. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets duration the client should wait between requests, in + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpointsUpdateHeaders.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpointsUpdateHeaders.cs new file mode 100644 index 000000000000..be990c4005f6 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineEndpointsUpdateHeaders.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class OnlineEndpointsUpdateHeaders + { + /// + /// Initializes a new instance of the OnlineEndpointsUpdateHeaders + /// class. + /// + public OnlineEndpointsUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OnlineEndpointsUpdateHeaders + /// class. + /// + /// Timeout for the client to + /// use when polling the asynchronous operation. + /// URI to poll for asynchronous operation + /// result. + /// Duration the client should wait between + /// requests, in seconds. + public OnlineEndpointsUpdateHeaders(System.TimeSpan? xMsAsyncOperationTimeout = default(System.TimeSpan?), string location = default(string), int? retryAfter = default(int?)) + { + XMsAsyncOperationTimeout = xMsAsyncOperationTimeout; + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets timeout for the client to use when polling the + /// asynchronous operation. + /// + [JsonProperty(PropertyName = "x-ms-async-operation-timeout")] + public System.TimeSpan? XMsAsyncOperationTimeout { get; set; } + + /// + /// Gets or sets URI to poll for asynchronous operation result. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets duration the client should wait between requests, in + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineRequestSettings.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineRequestSettings.cs new file mode 100644 index 000000000000..c4fdde406d2f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineRequestSettings.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Online deployment scoring requests configuration. + /// + public partial class OnlineRequestSettings + { + /// + /// Initializes a new instance of the OnlineRequestSettings class. + /// + public OnlineRequestSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OnlineRequestSettings class. + /// + /// The number of + /// requests allowed to queue at once for this deployment. + /// The maximum queue wait time in ISO 8601 + /// format. Supports millisecond precision. + /// The request timeout in ISO 8601 + /// format. Supports millisecond precision. + public OnlineRequestSettings(int? maxConcurrentRequestsPerInstance = default(int?), System.TimeSpan? maxQueueWait = default(System.TimeSpan?), System.TimeSpan? requestTimeout = default(System.TimeSpan?)) + { + MaxConcurrentRequestsPerInstance = maxConcurrentRequestsPerInstance; + MaxQueueWait = maxQueueWait; + RequestTimeout = requestTimeout; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of requests allowed to queue at once for + /// this deployment. + /// + [JsonProperty(PropertyName = "maxConcurrentRequestsPerInstance")] + public int? MaxConcurrentRequestsPerInstance { get; set; } + + /// + /// Gets or sets the maximum queue wait time in ISO 8601 format. + /// Supports millisecond precision. + /// + [JsonProperty(PropertyName = "maxQueueWait")] + public System.TimeSpan? MaxQueueWait { get; set; } + + /// + /// Gets or sets the request timeout in ISO 8601 format. Supports + /// millisecond precision. + /// + [JsonProperty(PropertyName = "requestTimeout")] + public System.TimeSpan? RequestTimeout { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineScaleSettings.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineScaleSettings.cs new file mode 100644 index 000000000000..91084e4598df --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OnlineScaleSettings.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Online deployment scaling configuration. + /// + public partial class OnlineScaleSettings + { + /// + /// Initializes a new instance of the OnlineScaleSettings class. + /// + public OnlineScaleSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OnlineScaleSettings class. + /// + /// Maximum number of instances for this + /// deployment. + /// Minimum number of instances for this + /// deployment. + public OnlineScaleSettings(int? maxInstances = default(int?), int? minInstances = default(int?)) + { + MaxInstances = maxInstances; + MinInstances = minInstances; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets maximum number of instances for this deployment. + /// + [JsonProperty(PropertyName = "maxInstances")] + public int? MaxInstances { get; set; } + + /// + /// Gets or sets minimum number of instances for this deployment. + /// + [JsonProperty(PropertyName = "minInstances")] + public int? MinInstances { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OperatingSystemType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OperatingSystemType.cs new file mode 100644 index 000000000000..35ee94b0436b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OperatingSystemType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for OperatingSystemType. + /// + public static class OperatingSystemType + { + public const string Linux = "Linux"; + public const string Windows = "Windows"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Operation.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..de68889311e6 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Operation.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Machine Learning workspace REST API operation + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// Operation name: + /// {provider}/{resource}/{operation} + /// Display name of operation + public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay)) + { + Name = name; + Display = display; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets operation name: {provider}/{resource}/{operation} + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets display name of operation + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OperationDisplay.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..c7936af142fc --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Display name of 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 resource provider name: + /// Microsoft.MachineLearningExperimentation + /// The resource on which the operation is + /// performed. + /// The operation that users can + /// perform. + /// The description for the + /// operation. + 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 or sets the resource provider name: + /// Microsoft.MachineLearningExperimentation + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets the resource on which the operation is performed. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets the operation that users can perform. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets the description for the operation. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OperationName.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OperationName.cs new file mode 100644 index 000000000000..b1fcfaa4e89e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OperationName.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for OperationName. + /// + public static class OperationName + { + public const string Create = "Create"; + public const string Start = "Start"; + public const string Stop = "Stop"; + public const string Restart = "Restart"; + public const string Reimage = "Reimage"; + public const string Delete = "Delete"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OperationStatus.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OperationStatus.cs new file mode 100644 index 000000000000..9d1e82d7c737 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OperationStatus.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for OperationStatus. + /// + public static class OperationStatus + { + public const string InProgress = "InProgress"; + public const string Succeeded = "Succeeded"; + public const string CreateFailed = "CreateFailed"; + public const string StartFailed = "StartFailed"; + public const string StopFailed = "StopFailed"; + public const string RestartFailed = "RestartFailed"; + public const string ReimageFailed = "ReimageFailed"; + public const string DeleteFailed = "DeleteFailed"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OrderString.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OrderString.cs new file mode 100644 index 000000000000..a559d934ebab --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OrderString.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for OrderString. + /// + public static class OrderString + { + public const string CreatedAtDesc = "CreatedAtDesc"; + public const string CreatedAtAsc = "CreatedAtAsc"; + public const string UpdatedAtDesc = "UpdatedAtDesc"; + public const string UpdatedAtAsc = "UpdatedAtAsc"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OriginType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OriginType.cs new file mode 100644 index 000000000000..943c8c14a79e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OriginType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for OriginType. + /// + public static class OriginType + { + public const string Synapse = "Synapse"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OsType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OsType.cs new file mode 100644 index 000000000000..a3d4e9722bb8 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OsType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for OsType. + /// + public static class OsType + { + public const string Linux = "Linux"; + public const string Windows = "Windows"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OutputDataBinding.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OutputDataBinding.cs new file mode 100644 index 000000000000..c3430cb04ff3 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OutputDataBinding.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class OutputDataBinding + { + /// + /// Initializes a new instance of the OutputDataBinding class. + /// + public OutputDataBinding() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OutputDataBinding class. + /// + /// ARM resource ID of the datastore where + /// the data output will be stored. + /// Mechanism for data movement to datastore. + /// Possible values include: 'Mount', 'Download', 'Upload' + /// Location of data inside the container + /// process. + /// Path within the datastore to the + /// data. + public OutputDataBinding(string datastoreId = default(string), string mode = default(string), string pathOnCompute = default(string), string pathOnDatastore = default(string)) + { + DatastoreId = datastoreId; + Mode = mode; + PathOnCompute = pathOnCompute; + PathOnDatastore = pathOnDatastore; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ARM resource ID of the datastore where the data output + /// will be stored. + /// + [JsonProperty(PropertyName = "datastoreId")] + public string DatastoreId { get; set; } + + /// + /// Gets or sets mechanism for data movement to datastore. Possible + /// values include: 'Mount', 'Download', 'Upload' + /// + [JsonProperty(PropertyName = "mode")] + public string Mode { get; set; } + + /// + /// Gets or sets location of data inside the container process. + /// + [JsonProperty(PropertyName = "pathOnCompute")] + public string PathOnCompute { get; set; } + + /// + /// Gets or sets path within the datastore to the data. + /// + [JsonProperty(PropertyName = "pathOnDatastore")] + public string PathOnDatastore { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OutputPathAssetReference.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OutputPathAssetReference.cs new file mode 100644 index 000000000000..8091193787f7 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/OutputPathAssetReference.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Reference to an asset via its path in a job output. + /// + [Newtonsoft.Json.JsonObject("OutputPath")] + public partial class OutputPathAssetReference : AssetReferenceBase + { + /// + /// Initializes a new instance of the OutputPathAssetReference class. + /// + public OutputPathAssetReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OutputPathAssetReference class. + /// + /// ARM resource ID of the job. + /// The path of the file/directory in the job + /// output. + public OutputPathAssetReference(string jobId = default(string), string path = default(string)) + { + JobId = jobId; + Path = path; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ARM resource ID of the job. + /// + [JsonProperty(PropertyName = "jobId")] + public string JobId { get; set; } + + /// + /// Gets or sets the path of the file/directory in the job output. + /// + [JsonProperty(PropertyName = "path")] + public string Path { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Page.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Page.cs new file mode 100644 index 000000000000..174590e64d54 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/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.Azure.Management.MachineLearningServices.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("")] + 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Page1.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Page1.cs new file mode 100644 index 000000000000..12e6203f84cf --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Page1.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.Azure.Management.MachineLearningServices.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 Page1 : 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Page2.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Page2.cs new file mode 100644 index 000000000000..7615fcadf932 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Page2.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.Azure.Management.MachineLearningServices.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 Page2 : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("nodes")] + 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialAksOnlineDeployment.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialAksOnlineDeployment.cs new file mode 100644 index 000000000000..4bf793fed402 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialAksOnlineDeployment.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + [Newtonsoft.Json.JsonObject("K8S")] + public partial class PartialAksOnlineDeployment : PartialOnlineDeployment + { + /// + /// Initializes a new instance of the PartialAksOnlineDeployment class. + /// + public PartialAksOnlineDeployment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PartialAksOnlineDeployment class. + /// + /// Whether AppInsights telemetry is + /// enabled for this online deployment. + /// Deployment container liveness/readiness + /// probe configuration. + /// Online deployment scoring requests + /// configuration. + /// Online deployment scaling + /// configuration. + /// Resource requirements + /// for each container instance within an online deployment. + public PartialAksOnlineDeployment(bool? appInsightsEnabled = default(bool?), ProbeSettings livenessProbe = default(ProbeSettings), OnlineRequestSettings requestSettings = default(OnlineRequestSettings), OnlineScaleSettings scaleSettings = default(OnlineScaleSettings), ContainerResourceRequirements containerResourceRequirements = default(ContainerResourceRequirements)) + : base(appInsightsEnabled, livenessProbe, requestSettings, scaleSettings) + { + ContainerResourceRequirements = containerResourceRequirements; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource requirements for each container instance + /// within an online deployment. + /// + [JsonProperty(PropertyName = "containerResourceRequirements")] + public ContainerResourceRequirements ContainerResourceRequirements { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialBatchDeployment.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialBatchDeployment.cs new file mode 100644 index 000000000000..e992a4256ce8 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialBatchDeployment.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Mutable batch inference settings per deployment. + /// + public partial class PartialBatchDeployment + { + /// + /// Initializes a new instance of the PartialBatchDeployment class. + /// + public PartialBatchDeployment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PartialBatchDeployment class. + /// + /// Description of the endpoint + /// deployment. + public PartialBatchDeployment(string description = default(string)) + { + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets description of the endpoint deployment. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialBatchDeploymentPartialTrackedResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialBatchDeploymentPartialTrackedResource.cs new file mode 100644 index 000000000000..ed1da3b89d8c --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialBatchDeploymentPartialTrackedResource.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Strictly used in update requests. + /// + public partial class PartialBatchDeploymentPartialTrackedResource + { + /// + /// Initializes a new instance of the + /// PartialBatchDeploymentPartialTrackedResource class. + /// + public PartialBatchDeploymentPartialTrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PartialBatchDeploymentPartialTrackedResource class. + /// + /// Service identity associated with a + /// resource. + /// Metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// The geo-location where the resource + /// lives. + /// Additional attributes of the + /// entity. + /// Resource tags. + public PartialBatchDeploymentPartialTrackedResource(ResourceIdentity identity = default(ResourceIdentity), string kind = default(string), string location = default(string), PartialBatchDeployment properties = default(PartialBatchDeployment), IDictionary tags = default(IDictionary)) + { + Identity = identity; + Kind = kind; + Location = location; + Properties = properties; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service identity associated with a resource. + /// + [JsonProperty(PropertyName = "identity")] + public ResourceIdentity Identity { get; set; } + + /// + /// Gets or sets metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public PartialBatchDeployment Properties { get; set; } + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialBatchEndpoint.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialBatchEndpoint.cs new file mode 100644 index 000000000000..44e62b46ad07 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialBatchEndpoint.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Mutable Batch endpoint configuration + /// + public partial class PartialBatchEndpoint + { + /// + /// Initializes a new instance of the PartialBatchEndpoint class. + /// + public PartialBatchEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PartialBatchEndpoint class. + /// + /// Traffic rules on how the traffic will be + /// routed across deployments. + public PartialBatchEndpoint(IDictionary traffic = default(IDictionary)) + { + Traffic = traffic; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets traffic rules on how the traffic will be routed across + /// deployments. + /// + [JsonProperty(PropertyName = "traffic")] + public IDictionary Traffic { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialBatchEndpointPartialTrackedResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialBatchEndpointPartialTrackedResource.cs new file mode 100644 index 000000000000..2362369e78a2 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialBatchEndpointPartialTrackedResource.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Strictly used in update requests. + /// + public partial class PartialBatchEndpointPartialTrackedResource + { + /// + /// Initializes a new instance of the + /// PartialBatchEndpointPartialTrackedResource class. + /// + public PartialBatchEndpointPartialTrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PartialBatchEndpointPartialTrackedResource class. + /// + /// Service identity associated with a + /// resource. + /// Metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// The geo-location where the resource + /// lives. + /// Additional attributes of the + /// entity. + /// Resource tags. + public PartialBatchEndpointPartialTrackedResource(ResourceIdentity identity = default(ResourceIdentity), string kind = default(string), string location = default(string), PartialBatchEndpoint properties = default(PartialBatchEndpoint), IDictionary tags = default(IDictionary)) + { + Identity = identity; + Kind = kind; + Location = location; + Properties = properties; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service identity associated with a resource. + /// + [JsonProperty(PropertyName = "identity")] + public ResourceIdentity Identity { get; set; } + + /// + /// Gets or sets metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public PartialBatchEndpoint Properties { get; set; } + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialManagedOnlineDeployment.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialManagedOnlineDeployment.cs new file mode 100644 index 000000000000..173632f7485e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialManagedOnlineDeployment.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + [Newtonsoft.Json.JsonObject("Managed")] + public partial class PartialManagedOnlineDeployment : PartialOnlineDeployment + { + /// + /// Initializes a new instance of the PartialManagedOnlineDeployment + /// class. + /// + public PartialManagedOnlineDeployment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PartialManagedOnlineDeployment + /// class. + /// + /// Whether AppInsights telemetry is + /// enabled for this online deployment. + /// Deployment container liveness/readiness + /// probe configuration. + /// Online deployment scoring requests + /// configuration. + /// Online deployment scaling + /// configuration. + /// Deployment container + /// liveness/readiness probe configuration. + public PartialManagedOnlineDeployment(bool? appInsightsEnabled = default(bool?), ProbeSettings livenessProbe = default(ProbeSettings), OnlineRequestSettings requestSettings = default(OnlineRequestSettings), OnlineScaleSettings scaleSettings = default(OnlineScaleSettings), ProbeSettings readinessProbe = default(ProbeSettings)) + : base(appInsightsEnabled, livenessProbe, requestSettings, scaleSettings) + { + ReadinessProbe = readinessProbe; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets deployment container liveness/readiness probe + /// configuration. + /// + [JsonProperty(PropertyName = "readinessProbe")] + public ProbeSettings ReadinessProbe { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialOnlineDeployment.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialOnlineDeployment.cs new file mode 100644 index 000000000000..21043a70dc26 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialOnlineDeployment.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Mutable online deployment configuration + /// + public partial class PartialOnlineDeployment + { + /// + /// Initializes a new instance of the PartialOnlineDeployment class. + /// + public PartialOnlineDeployment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PartialOnlineDeployment class. + /// + /// Whether AppInsights telemetry is + /// enabled for this online deployment. + /// Deployment container liveness/readiness + /// probe configuration. + /// Online deployment scoring requests + /// configuration. + /// Online deployment scaling + /// configuration. + public PartialOnlineDeployment(bool? appInsightsEnabled = default(bool?), ProbeSettings livenessProbe = default(ProbeSettings), OnlineRequestSettings requestSettings = default(OnlineRequestSettings), OnlineScaleSettings scaleSettings = default(OnlineScaleSettings)) + { + AppInsightsEnabled = appInsightsEnabled; + LivenessProbe = livenessProbe; + RequestSettings = requestSettings; + ScaleSettings = scaleSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether AppInsights telemetry is enabled for this + /// online deployment. + /// + [JsonProperty(PropertyName = "appInsightsEnabled")] + public bool? AppInsightsEnabled { get; set; } + + /// + /// Gets or sets deployment container liveness/readiness probe + /// configuration. + /// + [JsonProperty(PropertyName = "livenessProbe")] + public ProbeSettings LivenessProbe { get; set; } + + /// + /// Gets or sets online deployment scoring requests configuration. + /// + [JsonProperty(PropertyName = "requestSettings")] + public OnlineRequestSettings RequestSettings { get; set; } + + /// + /// Gets or sets online deployment scaling configuration. + /// + [JsonProperty(PropertyName = "scaleSettings")] + public OnlineScaleSettings ScaleSettings { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialOnlineDeploymentPartialTrackedResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialOnlineDeploymentPartialTrackedResource.cs new file mode 100644 index 000000000000..8625cf7ad5a9 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialOnlineDeploymentPartialTrackedResource.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Strictly used in update requests. + /// + public partial class PartialOnlineDeploymentPartialTrackedResource + { + /// + /// Initializes a new instance of the + /// PartialOnlineDeploymentPartialTrackedResource class. + /// + public PartialOnlineDeploymentPartialTrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PartialOnlineDeploymentPartialTrackedResource class. + /// + /// Service identity associated with a + /// resource. + /// Metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// The geo-location where the resource + /// lives. + /// Additional attributes of the + /// entity. + /// Resource tags. + public PartialOnlineDeploymentPartialTrackedResource(ResourceIdentity identity = default(ResourceIdentity), string kind = default(string), string location = default(string), PartialOnlineDeployment properties = default(PartialOnlineDeployment), IDictionary tags = default(IDictionary)) + { + Identity = identity; + Kind = kind; + Location = location; + Properties = properties; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service identity associated with a resource. + /// + [JsonProperty(PropertyName = "identity")] + public ResourceIdentity Identity { get; set; } + + /// + /// Gets or sets metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public PartialOnlineDeployment Properties { get; set; } + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialOnlineEndpoint.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialOnlineEndpoint.cs new file mode 100644 index 000000000000..966097e40d51 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialOnlineEndpoint.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Mutable online endpoint configuration + /// + public partial class PartialOnlineEndpoint + { + /// + /// Initializes a new instance of the PartialOnlineEndpoint class. + /// + public PartialOnlineEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PartialOnlineEndpoint class. + /// + /// Traffic rules on how the traffic will be + /// routed across deployments. + public PartialOnlineEndpoint(IDictionary traffic = default(IDictionary)) + { + Traffic = traffic; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets traffic rules on how the traffic will be routed across + /// deployments. + /// + [JsonProperty(PropertyName = "traffic")] + public IDictionary Traffic { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialOnlineEndpointPartialTrackedResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialOnlineEndpointPartialTrackedResource.cs new file mode 100644 index 000000000000..fc8c46121820 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PartialOnlineEndpointPartialTrackedResource.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Strictly used in update requests. + /// + public partial class PartialOnlineEndpointPartialTrackedResource + { + /// + /// Initializes a new instance of the + /// PartialOnlineEndpointPartialTrackedResource class. + /// + public PartialOnlineEndpointPartialTrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PartialOnlineEndpointPartialTrackedResource class. + /// + /// Service identity associated with a + /// resource. + /// Metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// The geo-location where the resource + /// lives. + /// Additional attributes of the + /// entity. + /// Resource tags. + public PartialOnlineEndpointPartialTrackedResource(ResourceIdentity identity = default(ResourceIdentity), string kind = default(string), string location = default(string), PartialOnlineEndpoint properties = default(PartialOnlineEndpoint), IDictionary tags = default(IDictionary)) + { + Identity = identity; + Kind = kind; + Location = location; + Properties = properties; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service identity associated with a resource. + /// + [JsonProperty(PropertyName = "identity")] + public ResourceIdentity Identity { get; set; } + + /// + /// Gets or sets metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets additional attributes of the entity. + /// + [JsonProperty(PropertyName = "properties")] + public PartialOnlineEndpoint Properties { get; set; } + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Password.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Password.cs new file mode 100644 index 000000000000..22b5d7600608 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Password.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class Password + { + /// + /// Initializes a new instance of the Password class. + /// + public Password() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Password class. + /// + public Password(string name = default(string), string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PersonalComputeInstanceSettings.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PersonalComputeInstanceSettings.cs new file mode 100644 index 000000000000..230f1def54ba --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PersonalComputeInstanceSettings.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Settings for a personal compute instance. + /// + public partial class PersonalComputeInstanceSettings + { + /// + /// Initializes a new instance of the PersonalComputeInstanceSettings + /// class. + /// + public PersonalComputeInstanceSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PersonalComputeInstanceSettings + /// class. + /// + /// Assigned User. + public PersonalComputeInstanceSettings(AssignedUser assignedUser = default(AssignedUser)) + { + AssignedUser = assignedUser; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets assigned User. + /// + /// + /// A user explicitly assigned to a personal compute instance. + /// + [JsonProperty(PropertyName = "assignedUser")] + public AssignedUser AssignedUser { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AssignedUser != null) + { + AssignedUser.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateEndpoint.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateEndpoint.cs new file mode 100644 index 000000000000..1b7a6f44d608 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateEndpoint.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Private Endpoint resource. + /// + public partial class PrivateEndpoint + { + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + public PrivateEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + /// The ARM identifier for Private Endpoint + /// The ARM identifier for Subnet resource + /// that private endpoint links to + public PrivateEndpoint(string id = default(string), string subnetArmId = default(string)) + { + Id = id; + SubnetArmId = subnetArmId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the ARM identifier for Private Endpoint + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the ARM identifier for Subnet resource that private endpoint + /// links to + /// + [JsonProperty(PropertyName = "subnetArmId")] + public string SubnetArmId { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 000000000000..48b9ec54185a --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateEndpointConnection.cs @@ -0,0 +1,140 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Private Endpoint Connection resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateEndpointConnection : Resource + { + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + public PrivateEndpointConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + /// A collection of + /// information about the state of the connection between service + /// consumer and provider. + /// 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" + /// The resource of private end + /// point. + /// The provisioning state of the + /// private endpoint connection resource. Possible values include: + /// 'Succeeded', 'Creating', 'Deleting', 'Failed' + /// The identity of the resource. + /// Specifies the location of the + /// resource. + /// Contains resource tags defined as key/value + /// pairs. + /// The sku of the workspace. + public PrivateEndpointConnection(PrivateLinkServiceConnectionState privateLinkServiceConnectionState, string id = default(string), string name = default(string), string type = default(string), PrivateEndpoint privateEndpoint = default(PrivateEndpoint), string provisioningState = default(string), Identity identity = default(Identity), string location = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + Identity = identity; + Location = location; + Tags = tags; + Sku = sku; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource of private end point. + /// + [JsonProperty(PropertyName = "properties.privateEndpoint")] + public PrivateEndpoint PrivateEndpoint { get; set; } + + /// + /// Gets or sets a collection of information about the state of the + /// connection between service consumer and provider. + /// + [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] + public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + + /// + /// Gets or sets the provisioning state of the private endpoint + /// connection resource. Possible values include: 'Succeeded', + /// 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets the identity of the resource. + /// + [JsonProperty(PropertyName = "identity")] + public Identity Identity { get; set; } + + /// + /// Gets or sets specifies the location of the resource. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets contains resource tags defined as key/value pairs. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the sku of the workspace. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrivateLinkServiceConnectionState == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrivateLinkServiceConnectionState"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs new file mode 100644 index 000000000000..e5c43266e228 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateEndpointConnectionProvisioningState.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for PrivateEndpointConnectionProvisioningState. + /// + public static class PrivateEndpointConnectionProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Creating = "Creating"; + public const string Deleting = "Deleting"; + public const string Failed = "Failed"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs new file mode 100644 index 000000000000..fd8a93df2042 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateEndpointServiceConnectionStatus.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for PrivateEndpointServiceConnectionStatus. + /// + public static class PrivateEndpointServiceConnectionStatus + { + public const string Pending = "Pending"; + public const string Approved = "Approved"; + public const string Rejected = "Rejected"; + public const string Disconnected = "Disconnected"; + public const string Timeout = "Timeout"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateLinkResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateLinkResource.cs new file mode 100644 index 000000000000..8dbc3056b2e5 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateLinkResource.cs @@ -0,0 +1,121 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A private link resource + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateLinkResource : Resource + { + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + public PrivateLinkResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResource 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" + /// The private link resource group id. + /// The private link resource required + /// member names. + /// The private link resource Private + /// link DNS zone name. + /// The identity of the resource. + /// Specifies the location of the + /// resource. + /// Contains resource tags defined as key/value + /// pairs. + /// The sku of the workspace. + public PrivateLinkResource(string id = default(string), string name = default(string), string type = default(string), string groupId = default(string), IList requiredMembers = default(IList), IList requiredZoneNames = default(IList), Identity identity = default(Identity), string location = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + Identity = identity; + Location = location; + Tags = tags; + Sku = sku; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the private link resource group id. + /// + [JsonProperty(PropertyName = "properties.groupId")] + public string GroupId { get; private set; } + + /// + /// Gets the private link resource required member names. + /// + [JsonProperty(PropertyName = "properties.requiredMembers")] + public IList RequiredMembers { get; private set; } + + /// + /// Gets or sets the private link resource Private link DNS zone name. + /// + [JsonProperty(PropertyName = "properties.requiredZoneNames")] + public IList RequiredZoneNames { get; set; } + + /// + /// Gets or sets the identity of the resource. + /// + [JsonProperty(PropertyName = "identity")] + public Identity Identity { get; set; } + + /// + /// Gets or sets specifies the location of the resource. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets contains resource tags defined as key/value pairs. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the sku of the workspace. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateLinkResourceListResult.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateLinkResourceListResult.cs new file mode 100644 index 000000000000..9070ccc04ea9 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateLinkResourceListResult.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of private link resources + /// + public partial class PrivateLinkResourceListResult + { + /// + /// Initializes a new instance of the PrivateLinkResourceListResult + /// class. + /// + public PrivateLinkResourceListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResourceListResult + /// class. + /// + /// Array of private link resources + public PrivateLinkResourceListResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of private link resources + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateLinkServiceConnectionState.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateLinkServiceConnectionState.cs new file mode 100644 index 000000000000..68aac9347c96 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PrivateLinkServiceConnectionState.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A collection of information about the state of the connection between + /// service consumer and provider. + /// + public partial class PrivateLinkServiceConnectionState + { + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + public PrivateLinkServiceConnectionState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + /// Indicates whether the connection has been + /// Approved/Rejected/Removed by the owner of the service. Possible + /// values include: 'Pending', 'Approved', 'Rejected', 'Disconnected', + /// 'Timeout' + /// The reason for approval/rejection of the + /// connection. + /// A message indicating if changes on + /// the service provider require any updates on the consumer. + public PrivateLinkServiceConnectionState(string status = default(string), string description = default(string), string actionsRequired = default(string)) + { + Status = status; + Description = description; + ActionsRequired = actionsRequired; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether the connection has been + /// Approved/Rejected/Removed by the owner of the service. Possible + /// values include: 'Pending', 'Approved', 'Rejected', 'Disconnected', + /// 'Timeout' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the reason for approval/rejection of the connection. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets a message indicating if changes on the service + /// provider require any updates on the consumer. + /// + [JsonProperty(PropertyName = "actionsRequired")] + public string ActionsRequired { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ProbeSettings.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ProbeSettings.cs new file mode 100644 index 000000000000..3c56f28fd45a --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ProbeSettings.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Deployment container liveness/readiness probe configuration. + /// + public partial class ProbeSettings + { + /// + /// Initializes a new instance of the ProbeSettings class. + /// + public ProbeSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProbeSettings class. + /// + /// The number of failures to allow + /// before returning an unhealthy status. + /// The delay before the first probe in ISO + /// 8601 format. + /// The length of time between probes in ISO 8601 + /// format. + /// The number of successful probes + /// before returning a healthy status. + /// The probe timeout in ISO 8601 format. + public ProbeSettings(int? failureThreshold = default(int?), System.TimeSpan? initialDelay = default(System.TimeSpan?), System.TimeSpan? period = default(System.TimeSpan?), int? successThreshold = default(int?), System.TimeSpan? timeout = default(System.TimeSpan?)) + { + FailureThreshold = failureThreshold; + InitialDelay = initialDelay; + Period = period; + SuccessThreshold = successThreshold; + Timeout = timeout; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of failures to allow before returning an + /// unhealthy status. + /// + [JsonProperty(PropertyName = "failureThreshold")] + public int? FailureThreshold { get; set; } + + /// + /// Gets or sets the delay before the first probe in ISO 8601 format. + /// + [JsonProperty(PropertyName = "initialDelay")] + public System.TimeSpan? InitialDelay { get; set; } + + /// + /// Gets or sets the length of time between probes in ISO 8601 format. + /// + [JsonProperty(PropertyName = "period")] + public System.TimeSpan? Period { get; set; } + + /// + /// Gets or sets the number of successful probes before returning a + /// healthy status. + /// + [JsonProperty(PropertyName = "successThreshold")] + public int? SuccessThreshold { get; set; } + + /// + /// Gets or sets the probe timeout in ISO 8601 format. + /// + [JsonProperty(PropertyName = "timeout")] + public System.TimeSpan? Timeout { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ProgressMetrics.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ProgressMetrics.cs new file mode 100644 index 000000000000..effda2330403 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ProgressMetrics.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Progress metrics definition + /// + public partial class ProgressMetrics + { + /// + /// Initializes a new instance of the ProgressMetrics class. + /// + public ProgressMetrics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProgressMetrics class. + /// + /// The completed datapoint + /// count. + /// The time of last + /// successful incremental dataset refresh in UTC. + /// The skipped datapoint + /// count. + /// The total datapoint + /// count. + public ProgressMetrics(long? completedDatapointCount = default(long?), System.DateTime? incrementalDatasetLastRefreshTime = default(System.DateTime?), long? skippedDatapointCount = default(long?), long? totalDatapointCount = default(long?)) + { + CompletedDatapointCount = completedDatapointCount; + IncrementalDatasetLastRefreshTime = incrementalDatasetLastRefreshTime; + SkippedDatapointCount = skippedDatapointCount; + TotalDatapointCount = totalDatapointCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the completed datapoint count. + /// + [JsonProperty(PropertyName = "completedDatapointCount")] + public long? CompletedDatapointCount { get; private set; } + + /// + /// Gets the time of last successful incremental dataset refresh in + /// UTC. + /// + [JsonProperty(PropertyName = "incrementalDatasetLastRefreshTime")] + public System.DateTime? IncrementalDatasetLastRefreshTime { get; private set; } + + /// + /// Gets the skipped datapoint count. + /// + [JsonProperty(PropertyName = "skippedDatapointCount")] + public long? SkippedDatapointCount { get; private set; } + + /// + /// Gets the total datapoint count. + /// + [JsonProperty(PropertyName = "totalDatapointCount")] + public long? TotalDatapointCount { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ProvisioningState.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..d0cfe37ad21f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ProvisioningState. + /// + public static class ProvisioningState + { + public const string Unknown = "Unknown"; + public const string Updating = "Updating"; + public const string Creating = "Creating"; + public const string Deleting = "Deleting"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ProvisioningStatus.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ProvisioningStatus.cs new file mode 100644 index 000000000000..87fd9fbc524b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ProvisioningStatus.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ProvisioningStatus. + /// + public static class ProvisioningStatus + { + public const string Completed = "Completed"; + public const string Provisioning = "Provisioning"; + public const string Failed = "Failed"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ProxyResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..4719bd9bddb1 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ProxyResource.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.Azure.Management.MachineLearningServices.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" + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PyTorch.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PyTorch.cs new file mode 100644 index 000000000000..d38a502530ef --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/PyTorch.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// PyTorch distribution configuration. + /// + public partial class PyTorch : DistributionConfiguration + { + /// + /// Initializes a new instance of the PyTorch class. + /// + public PyTorch() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PyTorch class. + /// + /// Total process count for the distributed + /// job. + public PyTorch(int? processCount = default(int?)) + { + ProcessCount = processCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets total process count for the distributed job. + /// + [JsonProperty(PropertyName = "processCount")] + public int? ProcessCount { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/QuotaBaseProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/QuotaBaseProperties.cs new file mode 100644 index 000000000000..22c890df34eb --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/QuotaBaseProperties.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties for Quota update or retrieval. + /// + public partial class QuotaBaseProperties + { + /// + /// Initializes a new instance of the QuotaBaseProperties class. + /// + public QuotaBaseProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaBaseProperties class. + /// + /// Specifies the resource ID. + /// Specifies the resource type. + /// Limit. + /// An enum describing the unit of quota + /// measurement. Possible values include: 'Count' + public QuotaBaseProperties(string id = default(string), string type = default(string), long? limit = default(long?), string unit = default(string)) + { + Id = id; + Type = type; + Limit = limit; + Unit = unit; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the resource ID. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets specifies the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets limit. + /// + /// + /// The maximum permitted quota of the resource. + /// + [JsonProperty(PropertyName = "limit")] + public long? Limit { get; set; } + + /// + /// Gets or sets an enum describing the unit of quota measurement. + /// Possible values include: 'Count' + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/QuotaUnit.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/QuotaUnit.cs new file mode 100644 index 000000000000..12fd5189097f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/QuotaUnit.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for QuotaUnit. + /// + public static class QuotaUnit + { + public const string Count = "Count"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/QuotaUpdateParameters.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/QuotaUpdateParameters.cs new file mode 100644 index 000000000000..88462d4c3f96 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/QuotaUpdateParameters.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Quota update parameters. + /// + public partial class QuotaUpdateParameters + { + /// + /// Initializes a new instance of the QuotaUpdateParameters class. + /// + public QuotaUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaUpdateParameters class. + /// + /// The list for update quota. + /// Region of workspace quota to be + /// updated. + public QuotaUpdateParameters(IList value = default(IList), string location = default(string)) + { + Value = value; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list for update quota. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets or sets region of workspace quota to be updated. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ReasonCode.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ReasonCode.cs new file mode 100644 index 000000000000..12544612047b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ReasonCode.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ReasonCode. + /// + public static class ReasonCode + { + public const string NotSpecified = "NotSpecified"; + public const string NotAvailableForRegion = "NotAvailableForRegion"; + public const string NotAvailableForSubscription = "NotAvailableForSubscription"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Recurrence.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Recurrence.cs new file mode 100644 index 000000000000..d2a0fb7c5aa7 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Recurrence.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The workflow trigger recurrence for ComputeStartStop schedule type. + /// + public partial class Recurrence + { + /// + /// Initializes a new instance of the Recurrence class. + /// + public Recurrence() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Recurrence class. + /// + /// Possible values include: 'NotSpecified', + /// 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year' + /// The interval. + /// The start time. + /// The time zone. + public Recurrence(string frequency = default(string), int? interval = default(int?), string startTime = default(string), string timeZone = default(string), RecurrenceSchedule schedule = default(RecurrenceSchedule)) + { + Frequency = frequency; + Interval = interval; + StartTime = startTime; + TimeZone = timeZone; + Schedule = schedule; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'NotSpecified', 'Second', + /// 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year' + /// + [JsonProperty(PropertyName = "frequency")] + public string Frequency { get; set; } + + /// + /// Gets or sets the interval. + /// + [JsonProperty(PropertyName = "interval")] + public int? Interval { get; set; } + + /// + /// Gets or sets the start time. + /// + [JsonProperty(PropertyName = "startTime")] + public string StartTime { get; set; } + + /// + /// Gets or sets the time zone. + /// + [JsonProperty(PropertyName = "timeZone")] + public string TimeZone { get; set; } + + /// + /// + [JsonProperty(PropertyName = "schedule")] + public RecurrenceSchedule Schedule { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/RecurrenceFrequency.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/RecurrenceFrequency.cs new file mode 100644 index 000000000000..5f245a438ace --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/RecurrenceFrequency.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for RecurrenceFrequency. + /// + public static class RecurrenceFrequency + { + public const string NotSpecified = "NotSpecified"; + public const string Second = "Second"; + public const string Minute = "Minute"; + public const string Hour = "Hour"; + public const string Day = "Day"; + public const string Week = "Week"; + public const string Month = "Month"; + public const string Year = "Year"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/RecurrenceSchedule.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/RecurrenceSchedule.cs new file mode 100644 index 000000000000..0257f57efeb1 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/RecurrenceSchedule.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The recurrence schedule + /// + public partial class RecurrenceSchedule + { + /// + /// Initializes a new instance of the RecurrenceSchedule class. + /// + public RecurrenceSchedule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecurrenceSchedule class. + /// + /// The minutes. + /// The hours. + /// The days of the week. + public RecurrenceSchedule(IList minutes = default(IList), IList hours = default(IList), IList weekDays = default(IList)) + { + Minutes = minutes; + Hours = hours; + WeekDays = weekDays; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the minutes. + /// + [JsonProperty(PropertyName = "minutes")] + public IList Minutes { get; set; } + + /// + /// Gets or sets the hours. + /// + [JsonProperty(PropertyName = "hours")] + public IList Hours { get; set; } + + /// + /// Gets or sets the days of the week. + /// + [JsonProperty(PropertyName = "weekDays")] + public IList WeekDays { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ReferenceType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ReferenceType.cs new file mode 100644 index 000000000000..37600c99ca54 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ReferenceType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ReferenceType. + /// + public static class ReferenceType + { + public const string Id = "Id"; + public const string DataPath = "DataPath"; + public const string OutputPath = "OutputPath"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/RegenerateEndpointKeysRequest.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/RegenerateEndpointKeysRequest.cs new file mode 100644 index 000000000000..752be9c67824 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/RegenerateEndpointKeysRequest.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + public partial class RegenerateEndpointKeysRequest + { + /// + /// Initializes a new instance of the RegenerateEndpointKeysRequest + /// class. + /// + public RegenerateEndpointKeysRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RegenerateEndpointKeysRequest + /// class. + /// + /// Specification for which type of key to + /// generate. Primary or Secondary. Possible values include: 'Primary', + /// 'Secondary' + /// The value the key is set to. + public RegenerateEndpointKeysRequest(string keyType, string keyValue = default(string)) + { + KeyType = keyType; + KeyValue = keyValue; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specification for which type of key to generate. + /// Primary or Secondary. Possible values include: 'Primary', + /// 'Secondary' + /// + [JsonProperty(PropertyName = "keyType")] + public string KeyType { get; set; } + + /// + /// Gets or sets the value the key is set to. + /// + [JsonProperty(PropertyName = "keyValue")] + public string KeyValue { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KeyType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyType"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/RegistryListCredentialsResult.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/RegistryListCredentialsResult.cs new file mode 100644 index 000000000000..4295dd1dc569 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/RegistryListCredentialsResult.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class RegistryListCredentialsResult + { + /// + /// Initializes a new instance of the RegistryListCredentialsResult + /// class. + /// + public RegistryListCredentialsResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RegistryListCredentialsResult + /// class. + /// + public RegistryListCredentialsResult(string location = default(string), string username = default(string), IList passwords = default(IList)) + { + Location = location; + Username = username; + Passwords = passwords; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "username")] + public string Username { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "passwords")] + public IList Passwords { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/RemoteLoginPortPublicAccess.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/RemoteLoginPortPublicAccess.cs new file mode 100644 index 000000000000..f8ccbd19c200 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/RemoteLoginPortPublicAccess.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for RemoteLoginPortPublicAccess. + /// + public static class RemoteLoginPortPublicAccess + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + public const string NotSpecified = "NotSpecified"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Resource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Resource.cs new file mode 100644 index 000000000000..a4e2a535166a --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Resource.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.Azure.Management.MachineLearningServices.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" + public Resource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + 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; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceId.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceId.cs new file mode 100644 index 000000000000..05b8f70cd087 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceId.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a resource ID. For example, for a subnet, it is the resource + /// URL for the subnet. + /// + public partial class ResourceId : IResource + { + /// + /// Initializes a new instance of the ResourceId class. + /// + public ResourceId() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceId class. + /// + /// The ID of the resource + public ResourceId(string id) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the ID of the resource + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceIdentity.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceIdentity.cs new file mode 100644 index 000000000000..70c194f80696 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceIdentity.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Service identity associated with a resource. + /// + public partial class ResourceIdentity + { + /// + /// Initializes a new instance of the ResourceIdentity class. + /// + public ResourceIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceIdentity class. + /// + /// Client ID that is used when + /// authenticating. + /// AAD Tenant where this identity + /// lives. + /// Defines values for a ResourceIdentity's type. + /// Possible values include: 'SystemAssigned', 'UserAssigned', + /// 'SystemAssigned,UserAssigned', 'None' + /// Dictionary of the user + /// assigned identities, key is ARM resource ID of the UAI. + public ResourceIdentity(string principalId = default(string), string tenantId = default(string), string type = default(string), IDictionary userAssignedIdentities = default(IDictionary)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets client ID that is used when authenticating. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets AAD Tenant where this identity lives. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets defines values for a ResourceIdentity's type. Possible + /// values include: 'SystemAssigned', 'UserAssigned', + /// 'SystemAssigned,UserAssigned', 'None' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets dictionary of the user assigned identities, key is ARM + /// resource ID of the UAI. + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceIdentityAssignment.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceIdentityAssignment.cs new file mode 100644 index 000000000000..d328e04c4a30 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceIdentityAssignment.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ResourceIdentityAssignment. + /// + public static class ResourceIdentityAssignment + { + public const string SystemAssigned = "SystemAssigned"; + public const string UserAssigned = "UserAssigned"; + public const string SystemAssignedUserAssigned = "SystemAssigned,UserAssigned"; + public const string None = "None"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceIdentityType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 000000000000..9da209c2cf6b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceIdentityType.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.Azure.Management.MachineLearningServices.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, + [EnumMember(Value = "SystemAssigned,UserAssigned")] + SystemAssignedUserAssigned, + [EnumMember(Value = "UserAssigned")] + UserAssigned, + [EnumMember(Value = "None")] + None + } + 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"; + case ResourceIdentityType.SystemAssignedUserAssigned: + return "SystemAssigned,UserAssigned"; + case ResourceIdentityType.UserAssigned: + return "UserAssigned"; + case ResourceIdentityType.None: + return "None"; + } + return null; + } + + internal static ResourceIdentityType? ParseResourceIdentityType(this string value) + { + switch( value ) + { + case "SystemAssigned": + return ResourceIdentityType.SystemAssigned; + case "SystemAssigned,UserAssigned": + return ResourceIdentityType.SystemAssignedUserAssigned; + case "UserAssigned": + return ResourceIdentityType.UserAssigned; + case "None": + return ResourceIdentityType.None; + } + return null; + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceName.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceName.cs new file mode 100644 index 000000000000..ddf14b962231 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceName.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Resource Name. + /// + public partial class ResourceName + { + /// + /// Initializes a new instance of the ResourceName class. + /// + public ResourceName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceName class. + /// + /// The name of the resource. + /// The localized name of the + /// resource. + public ResourceName(string value = default(string), string localizedValue = default(string)) + { + Value = value; + LocalizedValue = localizedValue; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the resource. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; private set; } + + /// + /// Gets the localized name of the resource. + /// + [JsonProperty(PropertyName = "localizedValue")] + public string LocalizedValue { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceQuota.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceQuota.cs new file mode 100644 index 000000000000..72121dfb2b24 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceQuota.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The quota assigned to a resource. + /// + public partial class ResourceQuota + { + /// + /// Initializes a new instance of the ResourceQuota class. + /// + public ResourceQuota() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceQuota class. + /// + /// Specifies the resource ID. + /// Region of the AML workspace in + /// the id. + /// Specifies the resource type. + /// Name of the resource. + /// Limit. + /// An enum describing the unit of quota + /// measurement. Possible values include: 'Count' + public ResourceQuota(string id = default(string), string amlWorkspaceLocation = default(string), string type = default(string), ResourceName name = default(ResourceName), long? limit = default(long?), string unit = default(string)) + { + Id = id; + AmlWorkspaceLocation = amlWorkspaceLocation; + Type = type; + Name = name; + Limit = limit; + Unit = unit; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies the resource ID. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets region of the AML workspace in the id. + /// + [JsonProperty(PropertyName = "amlWorkspaceLocation")] + public string AmlWorkspaceLocation { get; private set; } + + /// + /// Gets specifies the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets name of the resource. + /// + [JsonProperty(PropertyName = "name")] + public ResourceName Name { get; private set; } + + /// + /// Gets limit. + /// + /// + /// The maximum permitted quota of the resource. + /// + [JsonProperty(PropertyName = "limit")] + public long? Limit { get; private set; } + + /// + /// Gets an enum describing the unit of quota measurement. Possible + /// values include: 'Count' + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceSkuLocationInfo.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceSkuLocationInfo.cs new file mode 100644 index 000000000000..6561b786334e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceSkuLocationInfo.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class ResourceSkuLocationInfo + { + /// + /// Initializes a new instance of the ResourceSkuLocationInfo class. + /// + public ResourceSkuLocationInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuLocationInfo class. + /// + /// Location of the SKU + /// List of availability zones where the SKU is + /// supported. + /// Details of capabilities available to a + /// SKU in specific zones. + public ResourceSkuLocationInfo(string location = default(string), IList zones = default(IList), IList zoneDetails = default(IList)) + { + Location = location; + Zones = zones; + ZoneDetails = zoneDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets location of the SKU + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets list of availability zones where the SKU is supported. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; private set; } + + /// + /// Gets details of capabilities available to a SKU in specific zones. + /// + [JsonProperty(PropertyName = "zoneDetails")] + public IList ZoneDetails { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceSkuZoneDetails.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceSkuZoneDetails.cs new file mode 100644 index 000000000000..ab43f870cc7f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ResourceSkuZoneDetails.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes The zonal capabilities of a SKU. + /// + public partial class ResourceSkuZoneDetails + { + /// + /// Initializes a new instance of the ResourceSkuZoneDetails class. + /// + public ResourceSkuZoneDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSkuZoneDetails class. + /// + /// The set of zones that the SKU is available in + /// with the specified capabilities. + /// A list of capabilities that are + /// available for the SKU in the specified list of zones. + public ResourceSkuZoneDetails(IList name = default(IList), IList capabilities = default(IList)) + { + Name = name; + Capabilities = capabilities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the set of zones that the SKU is available in with the + /// specified capabilities. + /// + [JsonProperty(PropertyName = "name")] + public IList Name { get; private set; } + + /// + /// Gets a list of capabilities that are available for the SKU in the + /// specified list of zones. + /// + [JsonProperty(PropertyName = "capabilities")] + public IList Capabilities { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Restriction.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Restriction.cs new file mode 100644 index 000000000000..31ae3583e47f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Restriction.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The restriction because of which SKU cannot be used. + /// + public partial class Restriction + { + /// + /// Initializes a new instance of the Restriction class. + /// + public Restriction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Restriction class. + /// + /// The type of restrictions. As of now only + /// possible value for this is location. + /// The value of restrictions. If the restriction + /// type is set to location. This would be different locations where + /// the SKU is restricted. + /// The reason for the restriction. Possible + /// values include: 'NotSpecified', 'NotAvailableForRegion', + /// 'NotAvailableForSubscription' + public Restriction(string type = default(string), IList values = default(IList), string reasonCode = default(string)) + { + Type = type; + Values = values; + ReasonCode = reasonCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of restrictions. As of now only possible value for + /// this is location. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the value of restrictions. If the restriction type is set to + /// location. This would be different locations where the SKU is + /// restricted. + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; private set; } + + /// + /// Gets or sets the reason for the restriction. Possible values + /// include: 'NotSpecified', 'NotAvailableForRegion', + /// 'NotAvailableForSubscription' + /// + [JsonProperty(PropertyName = "reasonCode")] + public string ReasonCode { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Route.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Route.cs new file mode 100644 index 000000000000..e56fab564fb4 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Route.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + public partial class Route + { + /// + /// Initializes a new instance of the Route class. + /// + public Route() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Route class. + /// + /// The path for the route. + /// The port for the route. + public Route(string path, int port) + { + Path = path; + Port = port; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the path for the route. + /// + [JsonProperty(PropertyName = "path")] + public string Path { get; set; } + + /// + /// Gets or sets the port for the route. + /// + [JsonProperty(PropertyName = "port")] + public int Port { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Path == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Path"); + } + if (Path != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Path, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Path", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SKUCapability.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SKUCapability.cs new file mode 100644 index 000000000000..2a70b2cd017a --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SKUCapability.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Features/user capabilities associated with the sku + /// + public partial class SKUCapability + { + /// + /// Initializes a new instance of the SKUCapability class. + /// + public SKUCapability() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SKUCapability class. + /// + /// Capability/Feature ID + /// Details about the feature/capability + public SKUCapability(string name = default(string), string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets capability/Feature ID + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets details about the feature/capability + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SamplingAlgorithm.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SamplingAlgorithm.cs new file mode 100644 index 000000000000..2b1e6d88cc44 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SamplingAlgorithm.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for SamplingAlgorithm. + /// + public static class SamplingAlgorithm + { + public const string Grid = "Grid"; + public const string Random = "Random"; + public const string Bayesian = "Bayesian"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SasDatastoreCredentials.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SasDatastoreCredentials.cs new file mode 100644 index 000000000000..8a42c2f9a426 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SasDatastoreCredentials.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// SAS datastore credentials configuration. + /// + [Newtonsoft.Json.JsonObject("Sas")] + public partial class SasDatastoreCredentials : DatastoreCredentials + { + /// + /// Initializes a new instance of the SasDatastoreCredentials class. + /// + public SasDatastoreCredentials() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SasDatastoreCredentials class. + /// + /// Storage container secrets. + public SasDatastoreCredentials(SasDatastoreSecrets secrets = default(SasDatastoreSecrets)) + { + Secrets = secrets; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets storage container secrets. + /// + [JsonProperty(PropertyName = "secrets")] + public SasDatastoreSecrets Secrets { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SasDatastoreSecrets.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SasDatastoreSecrets.cs new file mode 100644 index 000000000000..94894f3e2098 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SasDatastoreSecrets.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Datastore SAS secrets. + /// + [Newtonsoft.Json.JsonObject("Sas")] + public partial class SasDatastoreSecrets : DatastoreSecrets + { + /// + /// Initializes a new instance of the SasDatastoreSecrets class. + /// + public SasDatastoreSecrets() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SasDatastoreSecrets class. + /// + /// Storage container SAS token. + public SasDatastoreSecrets(string sasToken = default(string)) + { + SasToken = sasToken; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets storage container SAS token. + /// + [JsonProperty(PropertyName = "sasToken")] + public string SasToken { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScaleSettings.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScaleSettings.cs new file mode 100644 index 000000000000..58158d888691 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScaleSettings.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// scale settings for AML Compute + /// + public partial class ScaleSettings + { + /// + /// Initializes a new instance of the ScaleSettings class. + /// + public ScaleSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScaleSettings class. + /// + /// Max number of nodes to use + /// Min number of nodes to use + /// Node Idle Time before + /// scaling down amlCompute. This string needs to be in the RFC + /// Format. + public ScaleSettings(int maxNodeCount, int? minNodeCount = default(int?), System.TimeSpan? nodeIdleTimeBeforeScaleDown = default(System.TimeSpan?)) + { + MaxNodeCount = maxNodeCount; + MinNodeCount = minNodeCount; + NodeIdleTimeBeforeScaleDown = nodeIdleTimeBeforeScaleDown; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets max number of nodes to use + /// + [JsonProperty(PropertyName = "maxNodeCount")] + public int MaxNodeCount { get; set; } + + /// + /// Gets or sets min number of nodes to use + /// + [JsonProperty(PropertyName = "minNodeCount")] + public int? MinNodeCount { get; set; } + + /// + /// Gets or sets node Idle Time before scaling down amlCompute. This + /// string needs to be in the RFC Format. + /// + [JsonProperty(PropertyName = "nodeIdleTimeBeforeScaleDown")] + public System.TimeSpan? NodeIdleTimeBeforeScaleDown { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScaleType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScaleType.cs new file mode 100644 index 000000000000..65cbef3df2f6 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScaleType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ScaleType. + /// + public static class ScaleType + { + public const string Auto = "Auto"; + public const string Manual = "Manual"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScheduleStatus.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScheduleStatus.cs new file mode 100644 index 000000000000..4578f6618d6b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScheduleStatus.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ScheduleStatus. + /// + public static class ScheduleStatus + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScheduleType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScheduleType.cs new file mode 100644 index 000000000000..526b3d3e3a87 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScheduleType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ScheduleType. + /// + public static class ScheduleType + { + public const string ComputeStartStop = "ComputeStartStop"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScriptReference.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScriptReference.cs new file mode 100644 index 000000000000..4470a70e21ea --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScriptReference.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Script reference + /// + public partial class ScriptReference + { + /// + /// Initializes a new instance of the ScriptReference class. + /// + public ScriptReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScriptReference class. + /// + /// The storage source of the script: + /// inline, workspace. + /// The location of scripts in the mounted + /// volume. + /// Optional command line arguments + /// passed to the script to run. + /// Optional time period passed to timeout + /// command. + public ScriptReference(string scriptSource = default(string), string scriptData = default(string), string scriptArguments = default(string), string timeout = default(string)) + { + ScriptSource = scriptSource; + ScriptData = scriptData; + ScriptArguments = scriptArguments; + Timeout = timeout; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the storage source of the script: inline, workspace. + /// + [JsonProperty(PropertyName = "scriptSource")] + public string ScriptSource { get; set; } + + /// + /// Gets or sets the location of scripts in the mounted volume. + /// + [JsonProperty(PropertyName = "scriptData")] + public string ScriptData { get; set; } + + /// + /// Gets or sets optional command line arguments passed to the script + /// to run. + /// + [JsonProperty(PropertyName = "scriptArguments")] + public string ScriptArguments { get; set; } + + /// + /// Gets or sets optional time period passed to timeout command. + /// + [JsonProperty(PropertyName = "timeout")] + public string Timeout { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScriptsToExecute.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScriptsToExecute.cs new file mode 100644 index 000000000000..33905c9d7ef3 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ScriptsToExecute.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Customized setup scripts + /// + public partial class ScriptsToExecute + { + /// + /// Initializes a new instance of the ScriptsToExecute class. + /// + public ScriptsToExecute() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScriptsToExecute class. + /// + /// Script that's run every time the + /// machine starts. + /// Script that's run only once during + /// provision of the compute. + public ScriptsToExecute(ScriptReference startupScript = default(ScriptReference), ScriptReference creationScript = default(ScriptReference)) + { + StartupScript = startupScript; + CreationScript = creationScript; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets script that's run every time the machine starts. + /// + [JsonProperty(PropertyName = "startupScript")] + public ScriptReference StartupScript { get; set; } + + /// + /// Gets or sets script that's run only once during provision of the + /// compute. + /// + [JsonProperty(PropertyName = "creationScript")] + public ScriptReference CreationScript { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SecretsType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SecretsType.cs new file mode 100644 index 000000000000..aaee316c2f5f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SecretsType.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for SecretsType. + /// + public static class SecretsType + { + public const string AccountKey = "AccountKey"; + public const string Certificate = "Certificate"; + public const string None = "None"; + public const string Sas = "Sas"; + public const string ServicePrincipal = "ServicePrincipal"; + public const string SqlAdmin = "SqlAdmin"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ServiceManagedResourcesSettings.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ServiceManagedResourcesSettings.cs new file mode 100644 index 000000000000..74230b0c880e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ServiceManagedResourcesSettings.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ServiceManagedResourcesSettings + { + /// + /// Initializes a new instance of the ServiceManagedResourcesSettings + /// class. + /// + public ServiceManagedResourcesSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceManagedResourcesSettings + /// class. + /// + /// The settings for the service managed + /// cosmosdb account. + public ServiceManagedResourcesSettings(CosmosDbSettings cosmosDb = default(CosmosDbSettings)) + { + CosmosDb = cosmosDb; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the settings for the service managed cosmosdb account. + /// + [JsonProperty(PropertyName = "cosmosDb")] + public CosmosDbSettings CosmosDb { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ServicePrincipalCredentials.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ServicePrincipalCredentials.cs new file mode 100644 index 000000000000..94943dd5d243 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ServicePrincipalCredentials.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Service principal credentials. + /// + public partial class ServicePrincipalCredentials + { + /// + /// Initializes a new instance of the ServicePrincipalCredentials + /// class. + /// + public ServicePrincipalCredentials() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServicePrincipalCredentials + /// class. + /// + /// Client Id + /// Client secret + public ServicePrincipalCredentials(string clientId, string clientSecret) + { + ClientId = clientId; + ClientSecret = clientSecret; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets client Id + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; set; } + + /// + /// Gets or sets client secret + /// + [JsonProperty(PropertyName = "clientSecret")] + public string ClientSecret { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ClientId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ClientId"); + } + if (ClientSecret == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ClientSecret"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ServicePrincipalDatastoreCredentials.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ServicePrincipalDatastoreCredentials.cs new file mode 100644 index 000000000000..64fac9e58dc4 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ServicePrincipalDatastoreCredentials.cs @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Service Principal datastore credentials configuration. + /// + [Newtonsoft.Json.JsonObject("ServicePrincipal")] + public partial class ServicePrincipalDatastoreCredentials : DatastoreCredentials + { + /// + /// Initializes a new instance of the + /// ServicePrincipalDatastoreCredentials class. + /// + public ServicePrincipalDatastoreCredentials() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ServicePrincipalDatastoreCredentials class. + /// + /// Service principal client ID. + /// ID of the tenant to which the service + /// principal belongs. + /// Authority URL used for + /// authentication. + /// Resource the service principal has access + /// to. + /// Service principal secrets. + public ServicePrincipalDatastoreCredentials(System.Guid clientId, System.Guid tenantId, string authorityUrl = default(string), string resourceUri = default(string), ServicePrincipalDatastoreSecrets secrets = default(ServicePrincipalDatastoreSecrets)) + { + AuthorityUrl = authorityUrl; + ClientId = clientId; + ResourceUri = resourceUri; + Secrets = secrets; + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets authority URL used for authentication. + /// + [JsonProperty(PropertyName = "authorityUrl")] + public string AuthorityUrl { get; set; } + + /// + /// Gets or sets service principal client ID. + /// + [JsonProperty(PropertyName = "clientId")] + public System.Guid ClientId { get; set; } + + /// + /// Gets or sets resource the service principal has access to. + /// + [JsonProperty(PropertyName = "resourceUri")] + public string ResourceUri { get; set; } + + /// + /// Gets or sets service principal secrets. + /// + [JsonProperty(PropertyName = "secrets")] + public ServicePrincipalDatastoreSecrets Secrets { get; set; } + + /// + /// Gets or sets ID of the tenant to which the service principal + /// belongs. + /// + [JsonProperty(PropertyName = "tenantId")] + public System.Guid TenantId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ServicePrincipalDatastoreSecrets.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ServicePrincipalDatastoreSecrets.cs new file mode 100644 index 000000000000..f1eea57e4bc9 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ServicePrincipalDatastoreSecrets.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Datastore Service Principal secrets. + /// + [Newtonsoft.Json.JsonObject("ServicePrincipal")] + public partial class ServicePrincipalDatastoreSecrets : DatastoreSecrets + { + /// + /// Initializes a new instance of the ServicePrincipalDatastoreSecrets + /// class. + /// + public ServicePrincipalDatastoreSecrets() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServicePrincipalDatastoreSecrets + /// class. + /// + /// Service principal secret. + public ServicePrincipalDatastoreSecrets(string clientSecret = default(string)) + { + ClientSecret = clientSecret; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service principal secret. + /// + [JsonProperty(PropertyName = "clientSecret")] + public string ClientSecret { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SetupScripts.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SetupScripts.cs new file mode 100644 index 000000000000..d1e704506a8a --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SetupScripts.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Details of customized scripts to execute for setting up the cluster. + /// + public partial class SetupScripts + { + /// + /// Initializes a new instance of the SetupScripts class. + /// + public SetupScripts() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SetupScripts class. + /// + /// Customized setup scripts + public SetupScripts(ScriptsToExecute scripts = default(ScriptsToExecute)) + { + Scripts = scripts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets customized setup scripts + /// + [JsonProperty(PropertyName = "scripts")] + public ScriptsToExecute Scripts { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SharedPrivateLinkResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SharedPrivateLinkResource.cs new file mode 100644 index 000000000000..de547121006f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SharedPrivateLinkResource.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + [Rest.Serialization.JsonTransformation] + public partial class SharedPrivateLinkResource + { + /// + /// Initializes a new instance of the SharedPrivateLinkResource class. + /// + public SharedPrivateLinkResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SharedPrivateLinkResource class. + /// + /// Unique name of the private link. + /// The resource id that private + /// link links to. + /// The private link resource group id. + /// Request message. + /// Indicates whether the connection has been + /// Approved/Rejected/Removed by the owner of the service. Possible + /// values include: 'Pending', 'Approved', 'Rejected', 'Disconnected', + /// 'Timeout' + public SharedPrivateLinkResource(string name = default(string), string privateLinkResourceId = default(string), string groupId = default(string), string requestMessage = default(string), string status = default(string)) + { + Name = name; + PrivateLinkResourceId = privateLinkResourceId; + GroupId = groupId; + RequestMessage = requestMessage; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unique name of the private link. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the resource id that private link links to. + /// + [JsonProperty(PropertyName = "properties.privateLinkResourceId")] + public string PrivateLinkResourceId { get; set; } + + /// + /// Gets or sets the private link resource group id. + /// + [JsonProperty(PropertyName = "properties.groupId")] + public string GroupId { get; set; } + + /// + /// Gets or sets request message. + /// + [JsonProperty(PropertyName = "properties.requestMessage")] + public string RequestMessage { get; set; } + + /// + /// Gets or sets indicates whether the connection has been + /// Approved/Rejected/Removed by the owner of the service. Possible + /// values include: 'Pending', 'Approved', 'Rejected', 'Disconnected', + /// 'Timeout' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Sku.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Sku.cs new file mode 100644 index 000000000000..24aa1c175209 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Sku.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Sku of the resource + /// + public partial class Sku + { + /// + /// Initializes a new instance of the Sku class. + /// + public Sku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Sku class. + /// + /// Name of the sku + /// Tier of the sku like Basic or Enterprise + public Sku(string name = default(string), string tier = default(string)) + { + Name = name; + Tier = tier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the sku + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets tier of the sku like Basic or Enterprise + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SqlAdminDatastoreCredentials.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SqlAdminDatastoreCredentials.cs new file mode 100644 index 000000000000..aafb78a96d9a --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SqlAdminDatastoreCredentials.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// SQL Admin datastore credentials configuration. + /// + [Newtonsoft.Json.JsonObject("SqlAdmin")] + public partial class SqlAdminDatastoreCredentials : DatastoreCredentials + { + /// + /// Initializes a new instance of the SqlAdminDatastoreCredentials + /// class. + /// + public SqlAdminDatastoreCredentials() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlAdminDatastoreCredentials + /// class. + /// + /// SQL database user name. + /// SQL database secrets. + public SqlAdminDatastoreCredentials(string userId, SqlAdminDatastoreSecrets secrets = default(SqlAdminDatastoreSecrets)) + { + Secrets = secrets; + UserId = userId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets SQL database secrets. + /// + [JsonProperty(PropertyName = "secrets")] + public SqlAdminDatastoreSecrets Secrets { get; set; } + + /// + /// Gets or sets SQL database user name. + /// + [JsonProperty(PropertyName = "userId")] + public string UserId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (UserId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "UserId"); + } + if (UserId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(UserId, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "UserId", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SqlAdminDatastoreSecrets.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SqlAdminDatastoreSecrets.cs new file mode 100644 index 000000000000..28daed4016be --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SqlAdminDatastoreSecrets.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Datastore SQL Admin secrets. + /// + [Newtonsoft.Json.JsonObject("SqlAdmin")] + public partial class SqlAdminDatastoreSecrets : DatastoreSecrets + { + /// + /// Initializes a new instance of the SqlAdminDatastoreSecrets class. + /// + public SqlAdminDatastoreSecrets() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlAdminDatastoreSecrets class. + /// + /// SQL database password. + public SqlAdminDatastoreSecrets(string password = default(string)) + { + Password = password; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets SQL database password. + /// + [JsonProperty(PropertyName = "password")] + public string Password { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SshPublicAccess.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SshPublicAccess.cs new file mode 100644 index 000000000000..f90cf17a4180 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SshPublicAccess.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for SshPublicAccess. + /// + public static class SshPublicAccess + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SslConfiguration.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SslConfiguration.cs new file mode 100644 index 000000000000..c86702a6e866 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SslConfiguration.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The ssl configuration for scoring + /// + public partial class SslConfiguration + { + /// + /// Initializes a new instance of the SslConfiguration class. + /// + public SslConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SslConfiguration class. + /// + /// Enable or disable ssl for scoring. Possible + /// values include: 'Disabled', 'Enabled', 'Auto' + /// Cert data + /// Key data + /// CNAME of the cert + /// Leaf domain label of public + /// endpoint + /// Indicates whether to + /// overwrite existing domain label. + public SslConfiguration(string status = default(string), string cert = default(string), string key = default(string), string cname = default(string), string leafDomainLabel = default(string), bool? overwriteExistingDomain = default(bool?)) + { + Status = status; + Cert = cert; + Key = key; + Cname = cname; + LeafDomainLabel = leafDomainLabel; + OverwriteExistingDomain = overwriteExistingDomain; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets enable or disable ssl for scoring. Possible values + /// include: 'Disabled', 'Enabled', 'Auto' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets cert data + /// + [JsonProperty(PropertyName = "cert")] + public string Cert { get; set; } + + /// + /// Gets or sets key data + /// + [JsonProperty(PropertyName = "key")] + public string Key { get; set; } + + /// + /// Gets or sets CNAME of the cert + /// + [JsonProperty(PropertyName = "cname")] + public string Cname { get; set; } + + /// + /// Gets or sets leaf domain label of public endpoint + /// + [JsonProperty(PropertyName = "leafDomainLabel")] + public string LeafDomainLabel { get; set; } + + /// + /// Gets or sets indicates whether to overwrite existing domain label. + /// + [JsonProperty(PropertyName = "overwriteExistingDomain")] + public bool? OverwriteExistingDomain { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Status.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Status.cs new file mode 100644 index 000000000000..11bbc3f1f1e2 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Status.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for Status. + /// + public static class Status + { + public const string Undefined = "Undefined"; + public const string Success = "Success"; + public const string Failure = "Failure"; + public const string InvalidQuotaBelowClusterMinimum = "InvalidQuotaBelowClusterMinimum"; + public const string InvalidQuotaExceedsSubscriptionLimit = "InvalidQuotaExceedsSubscriptionLimit"; + public const string InvalidVMFamilyName = "InvalidVMFamilyName"; + public const string OperationNotSupportedForSku = "OperationNotSupportedForSku"; + public const string OperationNotEnabledForRegion = "OperationNotEnabledForRegion"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/StatusMessage.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/StatusMessage.cs new file mode 100644 index 000000000000..5a10ff4dd1fe --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/StatusMessage.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Active message associated with project + /// + public partial class StatusMessage + { + /// + /// Initializes a new instance of the StatusMessage class. + /// + public StatusMessage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StatusMessage class. + /// + /// Service-defined message code. + /// Time in UTC at which the message was + /// created. + /// Severity level of message. Possible values + /// include: 'Error', 'Information', 'Warning' + /// A human-readable representation of the + /// message code. + public StatusMessage(string code = default(string), System.DateTime? createdTimeUtc = default(System.DateTime?), string level = default(string), string message = default(string)) + { + Code = code; + CreatedTimeUtc = createdTimeUtc; + Level = level; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets service-defined message code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets time in UTC at which the message was created. + /// + [JsonProperty(PropertyName = "createdTimeUtc")] + public System.DateTime? CreatedTimeUtc { get; private set; } + + /// + /// Gets severity level of message. Possible values include: 'Error', + /// 'Information', 'Warning' + /// + [JsonProperty(PropertyName = "level")] + public string Level { get; private set; } + + /// + /// Gets a human-readable representation of the message code. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/StatusMessageLevel.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/StatusMessageLevel.cs new file mode 100644 index 000000000000..20304bb1aef8 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/StatusMessageLevel.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for StatusMessageLevel. + /// + public static class StatusMessageLevel + { + public const string Error = "Error"; + public const string Information = "Information"; + public const string Warning = "Warning"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SweepJob.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SweepJob.cs new file mode 100644 index 000000000000..0546faf49810 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SweepJob.cs @@ -0,0 +1,236 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Sweep job definition. + /// + [Newtonsoft.Json.JsonObject("Sweep")] + public partial class SweepJob : JobBase + { + /// + /// Initializes a new instance of the SweepJob class. + /// + public SweepJob() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SweepJob class. + /// + /// Type of the hyperparameter sampling + /// algorithms. Possible values include: 'Grid', 'Random', + /// 'Bayesian' + /// Compute binding for the job. + /// Optimization objective. + /// A dictionary containing each parameter + /// and its distribution. The dictionary key is the name of the + /// parameter + /// The asset description text. + /// List of JobEndpoints. + /// For local jobs, a job endpoint will have an endpoint value of + /// FileStreamObject. + /// The asset property dictionary. + /// Specifies the job provisioning + /// state. Possible values include: 'Succeeded', 'Failed', 'Canceled', + /// 'InProgress' + /// Tag dictionary. Tags can be added, removed, and + /// updated. + /// Early termination policies enable + /// canceling poor-performing runs before they complete. + /// The name of the experiment the job + /// belongs to. If not set, the job is placed in the "Default" + /// experiment. + /// Identity configuration. If set, this should + /// be one of AmlToken, ManagedIdentity or null. + /// Defaults to AmlToken if null. + /// An upper bound on the number of + /// trials performed in parallel. + /// An upper bound on the number of trials + /// to perform. + /// Location of the job output logs and + /// artifacts. + /// Job priority for scheduling policy. Only + /// applies to AMLCompute. + /// Private preview feature and only available to users on the allow + /// list. + /// The status of a job. Possible values include: + /// 'NotStarted', 'Starting', 'Provisioning', 'Preparing', 'Queued', + /// 'Running', 'Finalizing', 'CancelRequested', 'Completed', 'Failed', + /// 'Canceled', 'NotResponding', 'Paused', 'Unknown' + /// The total timeout in ISO 8601 format. Only + /// supports duration with precision as low as Minutes. + /// Trial component definition. + public SweepJob(string algorithm, ComputeConfiguration compute, Objective objective, IDictionary searchSpace, string description = default(string), IDictionary interactionEndpoints = default(IDictionary), IDictionary properties = default(IDictionary), string provisioningState = default(string), IDictionary tags = default(IDictionary), EarlyTerminationPolicy earlyTermination = default(EarlyTerminationPolicy), string experimentName = default(string), IdentityConfiguration identity = default(IdentityConfiguration), int? maxConcurrentTrials = default(int?), int? maxTotalTrials = default(int?), JobOutput output = default(JobOutput), int? priority = default(int?), string status = default(string), System.TimeSpan? timeout = default(System.TimeSpan?), TrialComponent trial = default(TrialComponent)) + : base(description, interactionEndpoints, properties, provisioningState, tags) + { + Algorithm = algorithm; + Compute = compute; + EarlyTermination = earlyTermination; + ExperimentName = experimentName; + Identity = identity; + MaxConcurrentTrials = maxConcurrentTrials; + MaxTotalTrials = maxTotalTrials; + Objective = objective; + Output = output; + Priority = priority; + SearchSpace = searchSpace; + Status = status; + Timeout = timeout; + Trial = trial; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of the hyperparameter sampling algorithms. + /// Possible values include: 'Grid', 'Random', 'Bayesian' + /// + [JsonProperty(PropertyName = "algorithm")] + public string Algorithm { get; set; } + + /// + /// Gets or sets compute binding for the job. + /// + [JsonProperty(PropertyName = "compute")] + public ComputeConfiguration Compute { get; set; } + + /// + /// Gets or sets early termination policies enable canceling + /// poor-performing runs before they complete. + /// + [JsonProperty(PropertyName = "earlyTermination")] + public EarlyTerminationPolicy EarlyTermination { get; set; } + + /// + /// Gets or sets the name of the experiment the job belongs to. If not + /// set, the job is placed in the "Default" experiment. + /// + [JsonProperty(PropertyName = "experimentName")] + public string ExperimentName { get; set; } + + /// + /// Gets or sets identity configuration. If set, this should be one of + /// AmlToken, ManagedIdentity or null. + /// Defaults to AmlToken if null. + /// + [JsonProperty(PropertyName = "identity")] + public IdentityConfiguration Identity { get; set; } + + /// + /// Gets or sets an upper bound on the number of trials performed in + /// parallel. + /// + [JsonProperty(PropertyName = "maxConcurrentTrials")] + public int? MaxConcurrentTrials { get; set; } + + /// + /// Gets or sets an upper bound on the number of trials to perform. + /// + [JsonProperty(PropertyName = "maxTotalTrials")] + public int? MaxTotalTrials { get; set; } + + /// + /// Gets or sets optimization objective. + /// + [JsonProperty(PropertyName = "objective")] + public Objective Objective { get; set; } + + /// + /// Gets location of the job output logs and artifacts. + /// + [JsonProperty(PropertyName = "output")] + public JobOutput Output { get; private set; } + + /// + /// Gets or sets job priority for scheduling policy. Only applies to + /// AMLCompute. + /// Private preview feature and only available to users on the allow + /// list. + /// + [JsonProperty(PropertyName = "priority")] + public int? Priority { get; set; } + + /// + /// Gets or sets a dictionary containing each parameter and its + /// distribution. The dictionary key is the name of the parameter + /// + [JsonProperty(PropertyName = "searchSpace")] + public IDictionary SearchSpace { get; set; } + + /// + /// Gets the status of a job. Possible values include: 'NotStarted', + /// 'Starting', 'Provisioning', 'Preparing', 'Queued', 'Running', + /// 'Finalizing', 'CancelRequested', 'Completed', 'Failed', 'Canceled', + /// 'NotResponding', 'Paused', 'Unknown' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets or sets the total timeout in ISO 8601 format. Only supports + /// duration with precision as low as Minutes. + /// + [JsonProperty(PropertyName = "timeout")] + public System.TimeSpan? Timeout { get; set; } + + /// + /// Gets or sets trial component definition. + /// + [JsonProperty(PropertyName = "trial")] + public TrialComponent Trial { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Algorithm == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Algorithm"); + } + if (Compute == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Compute"); + } + if (Objective == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Objective"); + } + if (SearchSpace == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SearchSpace"); + } + if (Objective != null) + { + Objective.Validate(); + } + if (Trial != null) + { + Trial.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SynapseSpark.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SynapseSpark.cs new file mode 100644 index 000000000000..1903a677ee63 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SynapseSpark.cs @@ -0,0 +1,170 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A SynapseSpark compute. + /// + public partial class SynapseSpark + { + /// + /// Initializes a new instance of the SynapseSpark class. + /// + public SynapseSpark() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SynapseSpark class. + /// + /// The type of compute. Possible values + /// include: 'AKS', 'AmlCompute', 'ComputeInstance', 'DataFactory', + /// 'VirtualMachine', 'HDInsight', 'Databricks', 'DataLakeAnalytics', + /// 'SynapseSpark' + /// Location for the underlying + /// compute + /// The provision state of the cluster. + /// Valid values are Unknown, Updating, Provisioning, Succeeded, and + /// Failed. Possible values include: 'Unknown', 'Updating', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// The description of the Machine Learning + /// compute. + /// The time at which the compute was + /// created. + /// The time at which the compute was last + /// modified. + /// ARM resource id of the underlying + /// compute + /// Errors during provisioning + /// Indicating whether the compute was + /// provisioned by user and brought from outside if true, or machine + /// learning service provisioned it if false. + /// Opt-out of local authentication and + /// ensure customers can use only MSI and AAD exclusively for + /// authentication. + /// AKS properties + public SynapseSpark(string computeType, string computeLocation = default(string), string provisioningState = default(string), string description = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? modifiedOn = default(System.DateTime?), string resourceId = default(string), IList provisioningErrors = default(IList), bool? isAttachedCompute = default(bool?), bool? disableLocalAuth = default(bool?), SynapseSparkProperties properties = default(SynapseSparkProperties)) + { + ComputeType = computeType; + ComputeLocation = computeLocation; + ProvisioningState = provisioningState; + Description = description; + CreatedOn = createdOn; + ModifiedOn = modifiedOn; + ResourceId = resourceId; + ProvisioningErrors = provisioningErrors; + IsAttachedCompute = isAttachedCompute; + DisableLocalAuth = disableLocalAuth; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of compute. Possible values include: 'AKS', + /// 'AmlCompute', 'ComputeInstance', 'DataFactory', 'VirtualMachine', + /// 'HDInsight', 'Databricks', 'DataLakeAnalytics', 'SynapseSpark' + /// + [JsonProperty(PropertyName = "computeType")] + public string ComputeType { get; set; } + + /// + /// Gets or sets location for the underlying compute + /// + [JsonProperty(PropertyName = "computeLocation")] + public string ComputeLocation { get; set; } + + /// + /// Gets the provision state of the cluster. Valid values are Unknown, + /// Updating, Provisioning, Succeeded, and Failed. Possible values + /// include: 'Unknown', 'Updating', 'Creating', 'Deleting', + /// 'Succeeded', 'Failed', 'Canceled' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the description of the Machine Learning compute. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets the time at which the compute was created. + /// + [JsonProperty(PropertyName = "createdOn")] + public System.DateTime? CreatedOn { get; private set; } + + /// + /// Gets the time at which the compute was last modified. + /// + [JsonProperty(PropertyName = "modifiedOn")] + public System.DateTime? ModifiedOn { get; private set; } + + /// + /// Gets or sets ARM resource id of the underlying compute + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets errors during provisioning + /// + [JsonProperty(PropertyName = "provisioningErrors")] + public IList ProvisioningErrors { get; private set; } + + /// + /// Gets indicating whether the compute was provisioned by user and + /// brought from outside if true, or machine learning service + /// provisioned it if false. + /// + [JsonProperty(PropertyName = "isAttachedCompute")] + public bool? IsAttachedCompute { get; private set; } + + /// + /// Gets or sets opt-out of local authentication and ensure customers + /// can use only MSI and AAD exclusively for authentication. + /// + [JsonProperty(PropertyName = "disableLocalAuth")] + public bool? DisableLocalAuth { get; set; } + + /// + /// Gets or sets AKS properties + /// + [JsonProperty(PropertyName = "properties")] + public SynapseSparkProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ComputeType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ComputeType"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SynapseSparkPoolProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SynapseSparkPoolProperties.cs new file mode 100644 index 000000000000..49071c1eae57 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SynapseSparkPoolProperties.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties specific to Synapse Spark pools. + /// + public partial class SynapseSparkPoolProperties + { + /// + /// Initializes a new instance of the SynapseSparkPoolProperties class. + /// + public SynapseSparkPoolProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SynapseSparkPoolProperties class. + /// + /// AKS properties + public SynapseSparkPoolProperties(SynapseSparkProperties properties = default(SynapseSparkProperties)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets AKS properties + /// + [JsonProperty(PropertyName = "properties")] + public SynapseSparkProperties Properties { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SynapseSparkProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SynapseSparkProperties.cs new file mode 100644 index 000000000000..2d585fd85b11 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SynapseSparkProperties.cs @@ -0,0 +1,128 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// AKS properties + /// + public partial class SynapseSparkProperties + { + /// + /// Initializes a new instance of the SynapseSparkProperties class. + /// + public SynapseSparkProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SynapseSparkProperties class. + /// + /// Auto scale properties. + /// Auto pause properties. + /// Spark version. + /// The number of compute nodes currently + /// assigned to the compute. + /// Node size. + /// Node size family. + /// Azure subscription identifier. + /// Name of the resource group in which + /// workspace is located. + /// Name of Azure Machine Learning + /// workspace. + /// Pool name. + public SynapseSparkProperties(AutoScaleProperties autoScaleProperties = default(AutoScaleProperties), AutoPauseProperties autoPauseProperties = default(AutoPauseProperties), string sparkVersion = default(string), int? nodeCount = default(int?), string nodeSize = default(string), string nodeSizeFamily = default(string), string subscriptionId = default(string), string resourceGroup = default(string), string workspaceName = default(string), string poolName = default(string)) + { + AutoScaleProperties = autoScaleProperties; + AutoPauseProperties = autoPauseProperties; + SparkVersion = sparkVersion; + NodeCount = nodeCount; + NodeSize = nodeSize; + NodeSizeFamily = nodeSizeFamily; + SubscriptionId = subscriptionId; + ResourceGroup = resourceGroup; + WorkspaceName = workspaceName; + PoolName = poolName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets auto scale properties. + /// + [JsonProperty(PropertyName = "autoScaleProperties")] + public AutoScaleProperties AutoScaleProperties { get; set; } + + /// + /// Gets or sets auto pause properties. + /// + [JsonProperty(PropertyName = "autoPauseProperties")] + public AutoPauseProperties AutoPauseProperties { get; set; } + + /// + /// Gets or sets spark version. + /// + [JsonProperty(PropertyName = "sparkVersion")] + public string SparkVersion { get; set; } + + /// + /// Gets or sets the number of compute nodes currently assigned to the + /// compute. + /// + [JsonProperty(PropertyName = "nodeCount")] + public int? NodeCount { get; set; } + + /// + /// Gets or sets node size. + /// + [JsonProperty(PropertyName = "nodeSize")] + public string NodeSize { get; set; } + + /// + /// Gets or sets node size family. + /// + [JsonProperty(PropertyName = "nodeSizeFamily")] + public string NodeSizeFamily { get; set; } + + /// + /// Gets or sets azure subscription identifier. + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; set; } + + /// + /// Gets or sets name of the resource group in which workspace is + /// located. + /// + [JsonProperty(PropertyName = "resourceGroup")] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets name of Azure Machine Learning workspace. + /// + [JsonProperty(PropertyName = "workspaceName")] + public string WorkspaceName { get; set; } + + /// + /// Gets or sets pool name. + /// + [JsonProperty(PropertyName = "poolName")] + public string PoolName { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SystemData.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..f53d17133688 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/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.Azure.Management.MachineLearningServices.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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SystemService.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SystemService.cs new file mode 100644 index 000000000000..36098f27a5a0 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/SystemService.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A system service running on a compute. + /// + public partial class SystemService + { + /// + /// Initializes a new instance of the SystemService class. + /// + public SystemService() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemService class. + /// + /// The type of this system + /// service. + /// Public IP address + /// The version for this type. + public SystemService(string systemServiceType = default(string), string publicIpAddress = default(string), string version = default(string)) + { + SystemServiceType = systemServiceType; + PublicIpAddress = publicIpAddress; + Version = version; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of this system service. + /// + [JsonProperty(PropertyName = "systemServiceType")] + public string SystemServiceType { get; private set; } + + /// + /// Gets public IP address + /// + [JsonProperty(PropertyName = "publicIpAddress")] + public string PublicIpAddress { get; private set; } + + /// + /// Gets the version for this type. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TensorFlow.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TensorFlow.cs new file mode 100644 index 000000000000..e0475f80f6b6 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TensorFlow.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// TensorFlow distribution configuration. + /// + public partial class TensorFlow : DistributionConfiguration + { + /// + /// Initializes a new instance of the TensorFlow class. + /// + public TensorFlow() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TensorFlow class. + /// + /// Number of parameter server + /// tasks. + /// Number of workers. Overwrites the node + /// count in compute binding. + public TensorFlow(int? parameterServerCount = default(int?), int? workerCount = default(int?)) + { + ParameterServerCount = parameterServerCount; + WorkerCount = workerCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets number of parameter server tasks. + /// + [JsonProperty(PropertyName = "parameterServerCount")] + public int? ParameterServerCount { get; set; } + + /// + /// Gets or sets number of workers. Overwrites the node count in + /// compute binding. + /// + [JsonProperty(PropertyName = "workerCount")] + public int? WorkerCount { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TextAnnotationType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TextAnnotationType.cs new file mode 100644 index 000000000000..31149b7ec99d --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TextAnnotationType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for TextAnnotationType. + /// + public static class TextAnnotationType + { + public const string Classification = "Classification"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TrackedResource.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TrackedResource.cs new file mode 100644 index 000000000000..5716d023a8d4 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TrackedResource.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.Azure.Management.MachineLearningServices.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" + /// Resource tags. + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + : base(id, name, type) + { + 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TrialComponent.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TrialComponent.cs new file mode 100644 index 000000000000..290c527efb53 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TrialComponent.cs @@ -0,0 +1,148 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Trial component definition. + /// + public partial class TrialComponent + { + /// + /// Initializes a new instance of the TrialComponent class. + /// + public TrialComponent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrialComponent class. + /// + /// The command to execute on startup of the job. + /// eg. "python train.py" + /// ARM resource ID of the code asset. + /// Distribution configuration of the job. + /// If set, this should be one of Mpi, Tensorflow, PyTorch, or + /// null. + /// The ARM resource ID of the Environment + /// specification for the job. + /// Environment variables included + /// in the job. + /// Mapping of input data bindings used + /// in the job. + /// Mapping of output data bindings + /// used in the job. + /// The max run duration in ISO 8601 format, + /// after which the trial component will be cancelled. + /// Only supports duration with precision as low as Seconds. + public TrialComponent(string command, string codeId = default(string), DistributionConfiguration distribution = default(DistributionConfiguration), string environmentId = default(string), IDictionary environmentVariables = default(IDictionary), IDictionary inputDataBindings = default(IDictionary), IDictionary outputDataBindings = default(IDictionary), System.TimeSpan? timeout = default(System.TimeSpan?)) + { + CodeId = codeId; + Command = command; + Distribution = distribution; + EnvironmentId = environmentId; + EnvironmentVariables = environmentVariables; + InputDataBindings = inputDataBindings; + OutputDataBindings = outputDataBindings; + Timeout = timeout; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ARM resource ID of the code asset. + /// + [JsonProperty(PropertyName = "codeId")] + public string CodeId { get; set; } + + /// + /// Gets or sets the command to execute on startup of the job. eg. + /// "python train.py" + /// + [JsonProperty(PropertyName = "command")] + public string Command { get; set; } + + /// + /// Gets or sets distribution configuration of the job. If set, this + /// should be one of Mpi, Tensorflow, PyTorch, or null. + /// + [JsonProperty(PropertyName = "distribution")] + public DistributionConfiguration Distribution { get; set; } + + /// + /// Gets or sets the ARM resource ID of the Environment specification + /// for the job. + /// + [JsonProperty(PropertyName = "environmentId")] + public string EnvironmentId { get; set; } + + /// + /// Gets or sets environment variables included in the job. + /// + [JsonProperty(PropertyName = "environmentVariables")] + public IDictionary EnvironmentVariables { get; set; } + + /// + /// Gets or sets mapping of input data bindings used in the job. + /// + [JsonProperty(PropertyName = "inputDataBindings")] + public IDictionary InputDataBindings { get; set; } + + /// + /// Gets or sets mapping of output data bindings used in the job. + /// + [JsonProperty(PropertyName = "outputDataBindings")] + public IDictionary OutputDataBindings { get; set; } + + /// + /// Gets or sets the max run duration in ISO 8601 format, after which + /// the trial component will be cancelled. + /// Only supports duration with precision as low as Seconds. + /// + [JsonProperty(PropertyName = "timeout")] + public System.TimeSpan? Timeout { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Command == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Command"); + } + if (Command != null) + { + if (Command.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Command", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(Command, "[a-zA-Z0-9_]")) + { + throw new ValidationException(ValidationRules.Pattern, "Command", "[a-zA-Z0-9_]"); + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TriggerType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TriggerType.cs new file mode 100644 index 000000000000..1e7487730895 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TriggerType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for TriggerType. + /// + public static class TriggerType + { + public const string Recurrence = "Recurrence"; + public const string Cron = "Cron"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TruncationSelectionPolicy.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TruncationSelectionPolicy.cs new file mode 100644 index 000000000000..00d64e632759 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/TruncationSelectionPolicy.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines an early termination policy that cancels a given percentage of + /// runs at each evaluation interval. + /// + [Newtonsoft.Json.JsonObject("TruncationSelection")] + public partial class TruncationSelectionPolicy : EarlyTerminationPolicy + { + /// + /// Initializes a new instance of the TruncationSelectionPolicy class. + /// + public TruncationSelectionPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TruncationSelectionPolicy class. + /// + /// Number of intervals by which to delay + /// the first evaluation. + /// Interval (number of runs) between + /// policy evaluations. + /// The percentage of runs to cancel + /// at each evaluation interval. + public TruncationSelectionPolicy(int? delayEvaluation = default(int?), int? evaluationInterval = default(int?), int? truncationPercentage = default(int?)) + : base(delayEvaluation, evaluationInterval) + { + TruncationPercentage = truncationPercentage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the percentage of runs to cancel at each evaluation + /// interval. + /// + [JsonProperty(PropertyName = "truncationPercentage")] + public int? TruncationPercentage { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UnderlyingResourceAction.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UnderlyingResourceAction.cs new file mode 100644 index 000000000000..a5a9773cfe21 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UnderlyingResourceAction.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for UnderlyingResourceAction. + /// + public static class UnderlyingResourceAction + { + public const string Delete = "Delete"; + public const string Detach = "Detach"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UpdateWorkspaceQuotas.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UpdateWorkspaceQuotas.cs new file mode 100644 index 000000000000..dfbed6af6800 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UpdateWorkspaceQuotas.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties for update Quota response. + /// + public partial class UpdateWorkspaceQuotas + { + /// + /// Initializes a new instance of the UpdateWorkspaceQuotas class. + /// + public UpdateWorkspaceQuotas() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateWorkspaceQuotas class. + /// + /// Specifies the resource ID. + /// Specifies the resource type. + /// Limit. + /// An enum describing the unit of quota + /// measurement. Possible values include: 'Count' + /// Update Workspace Quota Status. + public UpdateWorkspaceQuotas(string id = default(string), string type = default(string), long? limit = default(long?), string unit = default(string), string status = default(string)) + { + Id = id; + Type = type; + Limit = limit; + Unit = unit; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies the resource ID. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets specifies the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets limit. + /// + /// + /// The maximum permitted quota of the resource. + /// + [JsonProperty(PropertyName = "limit")] + public long? Limit { get; set; } + + /// + /// Gets an enum describing the unit of quota measurement. Possible + /// values include: 'Count' + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; private set; } + + /// + /// Gets or sets update Workspace Quota Status. + /// + /// + /// Status of update workspace quota. Possible values include: + /// 'Undefined', 'Success', 'Failure', + /// 'InvalidQuotaBelowClusterMinimum', + /// 'InvalidQuotaExceedsSubscriptionLimit', 'InvalidVMFamilyName', + /// 'OperationNotSupportedForSku', 'OperationNotEnabledForRegion' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UpdateWorkspaceQuotasResult.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UpdateWorkspaceQuotasResult.cs new file mode 100644 index 000000000000..8f98ce653400 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UpdateWorkspaceQuotasResult.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The result of update workspace quota. + /// + public partial class UpdateWorkspaceQuotasResult + { + /// + /// Initializes a new instance of the UpdateWorkspaceQuotasResult + /// class. + /// + public UpdateWorkspaceQuotasResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateWorkspaceQuotasResult + /// class. + /// + /// The list of workspace quota update + /// result. + /// The URI to fetch the next page of workspace + /// quota update result. Call ListNext() with this to fetch the next + /// page of Workspace Quota update result. + public UpdateWorkspaceQuotasResult(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 the list of workspace quota update result. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets the URI to fetch the next page of workspace quota update + /// result. Call ListNext() with this to fetch the next page of + /// Workspace Quota update result. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Usage.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Usage.cs new file mode 100644 index 000000000000..1ffcd96b5833 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Usage.cs @@ -0,0 +1,104 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes AML Resource Usage. + /// + public partial class Usage + { + /// + /// Initializes a new instance of the Usage class. + /// + public Usage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Usage class. + /// + /// Specifies the resource ID. + /// Region of the AML workspace in + /// the id. + /// Specifies the resource type. + /// An enum describing the unit of usage + /// measurement. Possible values include: 'Count' + /// The current usage of the + /// resource. + /// The maximum permitted usage of the + /// resource. + /// The name of the type of usage. + public Usage(string id = default(string), string amlWorkspaceLocation = default(string), string type = default(string), string unit = default(string), long? currentValue = default(long?), long? limit = default(long?), UsageName name = default(UsageName)) + { + Id = id; + AmlWorkspaceLocation = amlWorkspaceLocation; + Type = type; + Unit = unit; + CurrentValue = currentValue; + Limit = limit; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies the resource ID. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets region of the AML workspace in the id. + /// + [JsonProperty(PropertyName = "amlWorkspaceLocation")] + public string AmlWorkspaceLocation { get; private set; } + + /// + /// Gets specifies the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets an enum describing the unit of usage measurement. Possible + /// values include: 'Count' + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; private set; } + + /// + /// Gets the current usage of the resource. + /// + [JsonProperty(PropertyName = "currentValue")] + public long? CurrentValue { get; private set; } + + /// + /// Gets the maximum permitted usage of the resource. + /// + [JsonProperty(PropertyName = "limit")] + public long? Limit { get; private set; } + + /// + /// Gets the name of the type of usage. + /// + [JsonProperty(PropertyName = "name")] + public UsageName Name { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UsageName.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UsageName.cs new file mode 100644 index 000000000000..644d7026acde --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UsageName.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Usage Names. + /// + public partial class UsageName + { + /// + /// Initializes a new instance of the UsageName class. + /// + public UsageName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UsageName class. + /// + /// The name of the resource. + /// The localized name of the + /// resource. + public UsageName(string value = default(string), string localizedValue = default(string)) + { + Value = value; + LocalizedValue = localizedValue; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the resource. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; private set; } + + /// + /// Gets the localized name of the resource. + /// + [JsonProperty(PropertyName = "localizedValue")] + public string LocalizedValue { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UsageUnit.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UsageUnit.cs new file mode 100644 index 000000000000..fc4844f9e944 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UsageUnit.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for UsageUnit. + /// + public static class UsageUnit + { + public const string Count = "Count"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UserAccountCredentials.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UserAccountCredentials.cs new file mode 100644 index 000000000000..40bd59094483 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UserAccountCredentials.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Settings for user account that gets created on each on the nodes of a + /// compute. + /// + public partial class UserAccountCredentials + { + /// + /// Initializes a new instance of the UserAccountCredentials class. + /// + public UserAccountCredentials() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserAccountCredentials class. + /// + /// User name. + /// SSH public key. + /// Password. + public UserAccountCredentials(string adminUserName, string adminUserSshPublicKey = default(string), string adminUserPassword = default(string)) + { + AdminUserName = adminUserName; + AdminUserSshPublicKey = adminUserSshPublicKey; + AdminUserPassword = adminUserPassword; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets user name. + /// + /// + /// Name of the administrator user account which can be used to SSH to + /// nodes. + /// + [JsonProperty(PropertyName = "adminUserName")] + public string AdminUserName { get; set; } + + /// + /// Gets or sets SSH public key. + /// + /// + /// SSH public key of the administrator user account. + /// + [JsonProperty(PropertyName = "adminUserSshPublicKey")] + public string AdminUserSshPublicKey { get; set; } + + /// + /// Gets or sets password. + /// + /// + /// Password of the administrator user account. + /// + [JsonProperty(PropertyName = "adminUserPassword")] + public string AdminUserPassword { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AdminUserName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AdminUserName"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UserAssignedIdentity.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UserAssignedIdentity.cs new file mode 100644 index 000000000000..e2e6c9da48d5 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UserAssignedIdentity.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// User Assigned Identity + /// + 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 user assigned + /// identity. + /// The tenant ID of the user assigned + /// identity. + /// The clientId(aka appId) of the user assigned + /// identity. + public UserAssignedIdentity(string principalId = default(string), string tenantId = default(string), string clientId = default(string)) + { + PrincipalId = principalId; + TenantId = tenantId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal ID of the user assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the tenant ID of the user assigned identity. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets the clientId(aka appId) of the user assigned identity. + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; private set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UserAssignedIdentityMeta.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UserAssignedIdentityMeta.cs new file mode 100644 index 000000000000..505afa7085e1 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/UserAssignedIdentityMeta.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// User assigned identities associated with a resource. + /// + public partial class UserAssignedIdentityMeta + { + /// + /// Initializes a new instance of the UserAssignedIdentityMeta class. + /// + public UserAssignedIdentityMeta() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserAssignedIdentityMeta class. + /// + /// Aka application ID, a unique identifier + /// generated by Azure AD that is tied to an application and service + /// principal during its initial provisioning. + /// The object ID of the service principal + /// object for your managed identity that is used to grant role-based + /// access to an Azure resource. + public UserAssignedIdentityMeta(string clientId = default(string), string principalId = default(string)) + { + ClientId = clientId; + PrincipalId = principalId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets aka application ID, a unique identifier generated by + /// Azure AD that is tied to an application and service principal + /// during its initial provisioning. + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; set; } + + /// + /// Gets or sets the object ID of the service principal object for your + /// managed identity that is used to grant role-based access to an + /// Azure resource. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VMPriceOSType.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VMPriceOSType.cs new file mode 100644 index 000000000000..2748a8757a34 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VMPriceOSType.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for VMPriceOSType. + /// + public static class VMPriceOSType + { + public const string Linux = "Linux"; + public const string Windows = "Windows"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VMTier.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VMTier.cs new file mode 100644 index 000000000000..bc3fccff8ca4 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VMTier.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for VMTier. + /// + public static class VMTier + { + public const string Standard = "Standard"; + public const string LowPriority = "LowPriority"; + public const string Spot = "Spot"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ValueFormat.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ValueFormat.cs new file mode 100644 index 000000000000..804ef84903cd --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/ValueFormat.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for ValueFormat. + /// + public static class ValueFormat + { + public const string JSON = "JSON"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachine.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachine.cs new file mode 100644 index 000000000000..c7ca2851f9fe --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachine.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A Machine Learning compute based on Azure Virtual Machines. + /// + public partial class VirtualMachine : Compute + { + /// + /// Initializes a new instance of the VirtualMachine class. + /// + public VirtualMachine() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachine class. + /// + /// Location for the underlying + /// compute + /// The provision state of the cluster. + /// Valid values are Unknown, Updating, Provisioning, Succeeded, and + /// Failed. Possible values include: 'Unknown', 'Updating', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// The description of the Machine Learning + /// compute. + /// The time at which the compute was + /// created. + /// The time at which the compute was last + /// modified. + /// ARM resource id of the underlying + /// compute + /// Errors during provisioning + /// Indicating whether the compute was + /// provisioned by user and brought from outside if true, or machine + /// learning service provisioned it if false. + /// Opt-out of local authentication and + /// ensure customers can use only MSI and AAD exclusively for + /// authentication. + public VirtualMachine(string computeLocation = default(string), string provisioningState = default(string), string description = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? modifiedOn = default(System.DateTime?), string resourceId = default(string), IList provisioningErrors = default(IList), bool? isAttachedCompute = default(bool?), bool? disableLocalAuth = default(bool?), VirtualMachineProperties properties = default(VirtualMachineProperties)) + : base(computeLocation, provisioningState, description, createdOn, modifiedOn, resourceId, provisioningErrors, isAttachedCompute, disableLocalAuth) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties")] + public VirtualMachineProperties Properties { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineImage.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineImage.cs new file mode 100644 index 000000000000..1ed343239c15 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineImage.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Virtual Machine image for Windows AML Compute + /// + public partial class VirtualMachineImage + { + /// + /// Initializes a new instance of the VirtualMachineImage class. + /// + public VirtualMachineImage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineImage class. + /// + /// Virtual Machine image path + public VirtualMachineImage(string id) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets virtual Machine image path + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineProperties.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineProperties.cs new file mode 100644 index 000000000000..899da7c32088 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineProperties.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class VirtualMachineProperties + { + /// + /// Initializes a new instance of the VirtualMachineProperties class. + /// + public VirtualMachineProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineProperties class. + /// + /// Virtual Machine size + /// Port open for ssh connections. + /// Public IP address of the virtual + /// machine. + /// Admin credentials for virtual + /// machine + /// Indicates whether this + /// compute will be used for running notebooks. + public VirtualMachineProperties(string virtualMachineSize = default(string), int? sshPort = default(int?), string address = default(string), VirtualMachineSshCredentials administratorAccount = default(VirtualMachineSshCredentials), bool? isNotebookInstanceCompute = default(bool?)) + { + VirtualMachineSize = virtualMachineSize; + SshPort = sshPort; + Address = address; + AdministratorAccount = administratorAccount; + IsNotebookInstanceCompute = isNotebookInstanceCompute; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets virtual Machine size + /// + [JsonProperty(PropertyName = "virtualMachineSize")] + public string VirtualMachineSize { get; set; } + + /// + /// Gets or sets port open for ssh connections. + /// + [JsonProperty(PropertyName = "sshPort")] + public int? SshPort { get; set; } + + /// + /// Gets or sets public IP address of the virtual machine. + /// + [JsonProperty(PropertyName = "address")] + public string Address { get; set; } + + /// + /// Gets or sets admin credentials for virtual machine + /// + [JsonProperty(PropertyName = "administratorAccount")] + public VirtualMachineSshCredentials AdministratorAccount { get; set; } + + /// + /// Gets or sets indicates whether this compute will be used for + /// running notebooks. + /// + [JsonProperty(PropertyName = "isNotebookInstanceCompute")] + public bool? IsNotebookInstanceCompute { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineSecrets.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineSecrets.cs new file mode 100644 index 000000000000..07c927a68ccc --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineSecrets.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.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Secrets related to a Machine Learning compute based on AKS. + /// + [Newtonsoft.Json.JsonObject("VirtualMachine")] + public partial class VirtualMachineSecrets : ComputeSecrets + { + /// + /// Initializes a new instance of the VirtualMachineSecrets class. + /// + public VirtualMachineSecrets() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineSecrets class. + /// + /// Admin credentials for virtual + /// machine. + public VirtualMachineSecrets(VirtualMachineSshCredentials administratorAccount = default(VirtualMachineSshCredentials)) + { + AdministratorAccount = administratorAccount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets admin credentials for virtual machine. + /// + [JsonProperty(PropertyName = "administratorAccount")] + public VirtualMachineSshCredentials AdministratorAccount { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineSize.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineSize.cs new file mode 100644 index 000000000000..fb6c62f57a07 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineSize.cs @@ -0,0 +1,167 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the properties of a VM size. + /// + public partial class VirtualMachineSize + { + /// + /// Initializes a new instance of the VirtualMachineSize class. + /// + public VirtualMachineSize() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineSize class. + /// + /// Virtual Machine size name + /// Virtual Machine family name + /// Number of vPUs + /// Number of gPUs + /// OS VHD Disk size + /// Resource volume size + /// Memory size + /// Low priority capable + /// Premium IO supported + /// Estimated VM prices + public VirtualMachineSize(string name = default(string), string family = default(string), int? vCPUs = default(int?), int? gpus = default(int?), int? osVhdSizeMB = default(int?), int? maxResourceVolumeMB = default(int?), double? memoryGB = default(double?), bool? lowPriorityCapable = default(bool?), bool? premiumIO = default(bool?), EstimatedVMPrices estimatedVMPrices = default(EstimatedVMPrices)) + { + Name = name; + Family = family; + VCPUs = vCPUs; + Gpus = gpus; + OsVhdSizeMB = osVhdSizeMB; + MaxResourceVolumeMB = maxResourceVolumeMB; + MemoryGB = memoryGB; + LowPriorityCapable = lowPriorityCapable; + PremiumIO = premiumIO; + EstimatedVMPrices = estimatedVMPrices; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets virtual Machine size name + /// + /// + /// The name of the virtual machine size. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets virtual Machine family name + /// + /// + /// The family name of the virtual machine size. + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; private set; } + + /// + /// Gets number of vPUs + /// + /// + /// The number of vCPUs supported by the virtual machine size. + /// + [JsonProperty(PropertyName = "vCPUs")] + public int? VCPUs { get; private set; } + + /// + /// Gets number of gPUs + /// + /// + /// The number of gPUs supported by the virtual machine size. + /// + [JsonProperty(PropertyName = "gpus")] + public int? Gpus { get; private set; } + + /// + /// Gets OS VHD Disk size + /// + /// + /// The OS VHD disk size, in MB, allowed by the virtual machine size. + /// + [JsonProperty(PropertyName = "osVhdSizeMB")] + public int? OsVhdSizeMB { get; private set; } + + /// + /// Gets resource volume size + /// + /// + /// The resource volume size, in MB, allowed by the virtual machine + /// size. + /// + [JsonProperty(PropertyName = "maxResourceVolumeMB")] + public int? MaxResourceVolumeMB { get; private set; } + + /// + /// Gets memory size + /// + /// + /// The amount of memory, in GB, supported by the virtual machine size. + /// + [JsonProperty(PropertyName = "memoryGB")] + public double? MemoryGB { get; private set; } + + /// + /// Gets low priority capable + /// + /// + /// Specifies if the virtual machine size supports low priority VMs. + /// + [JsonProperty(PropertyName = "lowPriorityCapable")] + public bool? LowPriorityCapable { get; private set; } + + /// + /// Gets premium IO supported + /// + /// + /// Specifies if the virtual machine size supports premium IO. + /// + [JsonProperty(PropertyName = "premiumIO")] + public bool? PremiumIO { get; private set; } + + /// + /// Gets or sets estimated VM prices + /// + /// + /// The estimated price information for using a VM. + /// + [JsonProperty(PropertyName = "estimatedVMPrices")] + public EstimatedVMPrices EstimatedVMPrices { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EstimatedVMPrices != null) + { + EstimatedVMPrices.Validate(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineSizeListResult.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineSizeListResult.cs new file mode 100644 index 000000000000..8361485684fd --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineSizeListResult.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The List Virtual Machine size operation response. + /// + public partial class VirtualMachineSizeListResult + { + /// + /// Initializes a new instance of the VirtualMachineSizeListResult + /// class. + /// + public VirtualMachineSizeListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineSizeListResult + /// class. + /// + /// The list of virtual machine sizes supported by + /// AmlCompute. + public VirtualMachineSizeListResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of virtual machine sizes supported by + /// AmlCompute. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineSshCredentials.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineSshCredentials.cs new file mode 100644 index 000000000000..d0265f84753c --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VirtualMachineSshCredentials.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Admin credentials for virtual machine + /// + public partial class VirtualMachineSshCredentials + { + /// + /// Initializes a new instance of the VirtualMachineSshCredentials + /// class. + /// + public VirtualMachineSshCredentials() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineSshCredentials + /// class. + /// + /// Username of admin account + /// Password of admin account + /// Public key data + /// Private key data + public VirtualMachineSshCredentials(string username = default(string), string password = default(string), string publicKeyData = default(string), string privateKeyData = default(string)) + { + Username = username; + Password = password; + PublicKeyData = publicKeyData; + PrivateKeyData = privateKeyData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets username of admin account + /// + [JsonProperty(PropertyName = "username")] + public string Username { get; set; } + + /// + /// Gets or sets password of admin account + /// + [JsonProperty(PropertyName = "password")] + public string Password { get; set; } + + /// + /// Gets or sets public key data + /// + [JsonProperty(PropertyName = "publicKeyData")] + public string PublicKeyData { get; set; } + + /// + /// Gets or sets private key data + /// + [JsonProperty(PropertyName = "privateKeyData")] + public string PrivateKeyData { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VmPriority.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VmPriority.cs new file mode 100644 index 000000000000..699eace38926 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/VmPriority.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.Azure.Management.MachineLearningServices.Models +{ + + /// + /// Defines values for VmPriority. + /// + public static class VmPriority + { + public const string Dedicated = "Dedicated"; + public const string LowPriority = "LowPriority"; + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Workspace.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Workspace.cs new file mode 100644 index 000000000000..942fbd041348 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/Workspace.cs @@ -0,0 +1,336 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An object that represents a machine learning workspace. + /// + [Rest.Serialization.JsonTransformation] + public partial class Workspace : Resource + { + /// + /// Initializes a new instance of the Workspace class. + /// + public Workspace() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Workspace 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" + /// The immutable id associated with this + /// workspace. + /// The description of this + /// workspace. + /// The friendly name for this workspace. + /// This name in mutable + /// ARM id of the key vault associated with this + /// workspace. This cannot be changed once the workspace has been + /// created + /// ARM id of the application + /// insights associated with this workspace. This cannot be changed + /// once the workspace has been created + /// ARM id of the container registry + /// associated with this workspace. This cannot be changed once the + /// workspace has been created + /// ARM id of the storage account + /// associated with this workspace. This cannot be changed once the + /// workspace has been created + /// Url for the discovery service to + /// identify regional endpoints for machine learning experimentation + /// services + /// The current deployment state of + /// workspace resource. The provisioningState is to indicate states for + /// resource provisioning. Possible values include: 'Unknown', + /// 'Updating', 'Creating', 'Deleting', 'Succeeded', 'Failed', + /// 'Canceled' + /// The encryption settings of Azure ML + /// workspace. + /// The flag to signal HBI data in the + /// workspace and reduce diagnostic data collected by the + /// service + /// The name of the + /// managed resource group created by workspace RP in customer + /// subscription if the workspace is CMK workspace + /// Count of private connections in the + /// workspace + /// The compute name for image + /// build + /// The flag to indicate + /// whether to allow public access when behind VNet. + /// The list of private + /// endpoint connections in the workspace. + /// The list of shared private + /// link resources in this workspace. + /// The notebook info of Azure ML + /// workspace. + /// The service managed + /// resource settings. + /// The user assigned + /// identity resource id that represents the workspace + /// identity. + /// The tenant id associated with this + /// workspace. + /// The identity of the resource. + /// Specifies the location of the + /// resource. + /// Contains resource tags defined as key/value + /// pairs. + /// The sku of the workspace. + public Workspace(string id = default(string), string name = default(string), string type = default(string), string workspaceId = default(string), string description = default(string), string friendlyName = default(string), string keyVault = default(string), string applicationInsights = default(string), string containerRegistry = default(string), string storageAccount = default(string), string discoveryUrl = default(string), string provisioningState = default(string), EncryptionProperty encryption = default(EncryptionProperty), bool? hbiWorkspace = default(bool?), string serviceProvisionedResourceGroup = default(string), int? privateLinkCount = default(int?), string imageBuildCompute = default(string), bool? allowPublicAccessWhenBehindVnet = default(bool?), IList privateEndpointConnections = default(IList), IList sharedPrivateLinkResources = default(IList), NotebookResourceInfo notebookInfo = default(NotebookResourceInfo), ServiceManagedResourcesSettings serviceManagedResourcesSettings = default(ServiceManagedResourcesSettings), string primaryUserAssignedIdentity = default(string), string tenantId = default(string), Identity identity = default(Identity), string location = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + WorkspaceId = workspaceId; + Description = description; + FriendlyName = friendlyName; + KeyVault = keyVault; + ApplicationInsights = applicationInsights; + ContainerRegistry = containerRegistry; + StorageAccount = storageAccount; + DiscoveryUrl = discoveryUrl; + ProvisioningState = provisioningState; + Encryption = encryption; + HbiWorkspace = hbiWorkspace; + ServiceProvisionedResourceGroup = serviceProvisionedResourceGroup; + PrivateLinkCount = privateLinkCount; + ImageBuildCompute = imageBuildCompute; + AllowPublicAccessWhenBehindVnet = allowPublicAccessWhenBehindVnet; + PrivateEndpointConnections = privateEndpointConnections; + SharedPrivateLinkResources = sharedPrivateLinkResources; + NotebookInfo = notebookInfo; + ServiceManagedResourcesSettings = serviceManagedResourcesSettings; + PrimaryUserAssignedIdentity = primaryUserAssignedIdentity; + TenantId = tenantId; + Identity = identity; + Location = location; + Tags = tags; + Sku = sku; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the immutable id associated with this workspace. + /// + [JsonProperty(PropertyName = "properties.workspaceId")] + public string WorkspaceId { get; private set; } + + /// + /// Gets or sets the description of this workspace. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the friendly name for this workspace. This name in + /// mutable + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; set; } + + /// + /// Gets or sets ARM id of the key vault associated with this + /// workspace. This cannot be changed once the workspace has been + /// created + /// + [JsonProperty(PropertyName = "properties.keyVault")] + public string KeyVault { get; set; } + + /// + /// Gets or sets ARM id of the application insights associated with + /// this workspace. This cannot be changed once the workspace has been + /// created + /// + [JsonProperty(PropertyName = "properties.applicationInsights")] + public string ApplicationInsights { get; set; } + + /// + /// Gets or sets ARM id of the container registry associated with this + /// workspace. This cannot be changed once the workspace has been + /// created + /// + [JsonProperty(PropertyName = "properties.containerRegistry")] + public string ContainerRegistry { get; set; } + + /// + /// Gets or sets ARM id of the storage account associated with this + /// workspace. This cannot be changed once the workspace has been + /// created + /// + [JsonProperty(PropertyName = "properties.storageAccount")] + public string StorageAccount { get; set; } + + /// + /// Gets or sets url for the discovery service to identify regional + /// endpoints for machine learning experimentation services + /// + [JsonProperty(PropertyName = "properties.discoveryUrl")] + public string DiscoveryUrl { get; set; } + + /// + /// Gets the current deployment state of workspace resource. The + /// provisioningState is to indicate states for resource provisioning. + /// Possible values include: 'Unknown', 'Updating', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the encryption settings of Azure ML workspace. + /// + [JsonProperty(PropertyName = "properties.encryption")] + public EncryptionProperty Encryption { get; set; } + + /// + /// Gets or sets the flag to signal HBI data in the workspace and + /// reduce diagnostic data collected by the service + /// + [JsonProperty(PropertyName = "properties.hbiWorkspace")] + public bool? HbiWorkspace { get; set; } + + /// + /// Gets the name of the managed resource group created by workspace RP + /// in customer subscription if the workspace is CMK workspace + /// + [JsonProperty(PropertyName = "properties.serviceProvisionedResourceGroup")] + public string ServiceProvisionedResourceGroup { get; private set; } + + /// + /// Gets count of private connections in the workspace + /// + [JsonProperty(PropertyName = "properties.privateLinkCount")] + public int? PrivateLinkCount { get; private set; } + + /// + /// Gets or sets the compute name for image build + /// + [JsonProperty(PropertyName = "properties.imageBuildCompute")] + public string ImageBuildCompute { get; set; } + + /// + /// Gets or sets the flag to indicate whether to allow public access + /// when behind VNet. + /// + [JsonProperty(PropertyName = "properties.allowPublicAccessWhenBehindVnet")] + public bool? AllowPublicAccessWhenBehindVnet { get; set; } + + /// + /// Gets the list of private endpoint connections in the workspace. + /// + [JsonProperty(PropertyName = "properties.privateEndpointConnections")] + public IList PrivateEndpointConnections { get; private set; } + + /// + /// Gets or sets the list of shared private link resources in this + /// workspace. + /// + [JsonProperty(PropertyName = "properties.sharedPrivateLinkResources")] + public IList SharedPrivateLinkResources { get; set; } + + /// + /// Gets the notebook info of Azure ML workspace. + /// + [JsonProperty(PropertyName = "properties.notebookInfo")] + public NotebookResourceInfo NotebookInfo { get; private set; } + + /// + /// Gets or sets the service managed resource settings. + /// + [JsonProperty(PropertyName = "properties.serviceManagedResourcesSettings")] + public ServiceManagedResourcesSettings ServiceManagedResourcesSettings { get; set; } + + /// + /// Gets or sets the user assigned identity resource id that represents + /// the workspace identity. + /// + [JsonProperty(PropertyName = "properties.primaryUserAssignedIdentity")] + public string PrimaryUserAssignedIdentity { get; set; } + + /// + /// Gets the tenant id associated with this workspace. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the identity of the resource. + /// + [JsonProperty(PropertyName = "identity")] + public Identity Identity { get; set; } + + /// + /// Gets or sets specifies the location of the resource. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets contains resource tags defined as key/value pairs. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the sku of the workspace. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Encryption != null) + { + Encryption.Validate(); + } + if (PrivateEndpointConnections != null) + { + foreach (var element in PrivateEndpointConnections) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/WorkspaceConnection.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/WorkspaceConnection.cs new file mode 100644 index 000000000000..afa5c234183f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/WorkspaceConnection.cs @@ -0,0 +1,117 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Workspace connection. + /// + [Rest.Serialization.JsonTransformation] + public partial class WorkspaceConnection : IResource + { + /// + /// Initializes a new instance of the WorkspaceConnection class. + /// + public WorkspaceConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkspaceConnection class. + /// + /// ResourceId of the workspace connection. + /// Friendly name of the workspace + /// connection. + /// Resource type of workspace connection. + /// Category of the workspace + /// connection. + /// Target of the workspace connection. + /// Authorization type of the workspace + /// connection. + /// Value details of the workspace + /// connection. + /// format for the workspace connection + /// value. Possible values include: 'JSON' + public WorkspaceConnection(string id = default(string), string name = default(string), string type = default(string), string category = default(string), string target = default(string), string authType = default(string), string value = default(string), string valueFormat = default(string)) + { + Id = id; + Name = name; + Type = type; + Category = category; + Target = target; + AuthType = authType; + Value = value; + ValueFormat = valueFormat; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resourceId of the workspace connection. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets friendly name of the workspace connection. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type of workspace connection. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets category of the workspace connection. + /// + [JsonProperty(PropertyName = "properties.category")] + public string Category { get; set; } + + /// + /// Gets or sets target of the workspace connection. + /// + [JsonProperty(PropertyName = "properties.target")] + public string Target { get; set; } + + /// + /// Gets or sets authorization type of the workspace connection. + /// + [JsonProperty(PropertyName = "properties.authType")] + public string AuthType { get; set; } + + /// + /// Gets or sets value details of the workspace connection. + /// + [JsonProperty(PropertyName = "properties.value")] + public string Value { get; set; } + + /// + /// Gets or sets format for the workspace connection value. Possible + /// values include: 'JSON' + /// + [JsonProperty(PropertyName = "properties.valueFormat")] + public string ValueFormat { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/WorkspaceSku.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/WorkspaceSku.cs new file mode 100644 index 000000000000..6969e7d07cf2 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/WorkspaceSku.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes Workspace Sku details and features + /// + public partial class WorkspaceSku + { + /// + /// Initializes a new instance of the WorkspaceSku class. + /// + public WorkspaceSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkspaceSku class. + /// + /// The set of locations that the SKU is + /// available. This will be supported and registered Azure Geo Regions + /// (e.g. West US, East US, Southeast Asia, etc.). + /// A list of locations and availability + /// zones in those locations where the SKU is available. + /// Sku Tier like Basic or Enterprise + /// List of features/user capabilities + /// associated with the sku + /// The restrictions because of which SKU + /// cannot be used. This is empty if there are no restrictions. + public WorkspaceSku(IList locations = default(IList), IList locationInfo = default(IList), string tier = default(string), string resourceType = default(string), string name = default(string), IList capabilities = default(IList), IList restrictions = default(IList)) + { + Locations = locations; + LocationInfo = locationInfo; + Tier = tier; + ResourceType = resourceType; + Name = name; + Capabilities = capabilities; + Restrictions = restrictions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the set of locations that the SKU is available. This will be + /// supported and registered Azure Geo Regions (e.g. West US, East US, + /// Southeast Asia, etc.). + /// + [JsonProperty(PropertyName = "locations")] + public IList Locations { get; private set; } + + /// + /// Gets a list of locations and availability zones in those locations + /// where the SKU is available. + /// + [JsonProperty(PropertyName = "locationInfo")] + public IList LocationInfo { get; private set; } + + /// + /// Gets sku Tier like Basic or Enterprise + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets list of features/user capabilities associated with the sku + /// + [JsonProperty(PropertyName = "capabilities")] + public IList Capabilities { get; private set; } + + /// + /// Gets or sets the restrictions because of which SKU cannot be used. + /// This is empty if there are no restrictions. + /// + [JsonProperty(PropertyName = "restrictions")] + public IList Restrictions { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/WorkspaceUpdateParameters.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/WorkspaceUpdateParameters.cs new file mode 100644 index 000000000000..ea2c761fa259 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Models/WorkspaceUpdateParameters.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.Azure.Management.MachineLearningServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The parameters for updating a machine learning workspace. + /// + [Rest.Serialization.JsonTransformation] + public partial class WorkspaceUpdateParameters + { + /// + /// Initializes a new instance of the WorkspaceUpdateParameters class. + /// + public WorkspaceUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkspaceUpdateParameters class. + /// + /// The resource tags for the machine learning + /// workspace. + /// The sku of the workspace. + /// The identity of the resource. + /// The description of this + /// workspace. + /// The friendly name for this + /// workspace. + /// The compute name for image + /// build + /// The service managed + /// resource settings. + /// The user assigned + /// identity resource id that represents the workspace + /// identity. + public WorkspaceUpdateParameters(IDictionary tags = default(IDictionary), Sku sku = default(Sku), Identity identity = default(Identity), string description = default(string), string friendlyName = default(string), string imageBuildCompute = default(string), ServiceManagedResourcesSettings serviceManagedResourcesSettings = default(ServiceManagedResourcesSettings), string primaryUserAssignedIdentity = default(string)) + { + Tags = tags; + Sku = sku; + Identity = identity; + Description = description; + FriendlyName = friendlyName; + ImageBuildCompute = imageBuildCompute; + ServiceManagedResourcesSettings = serviceManagedResourcesSettings; + PrimaryUserAssignedIdentity = primaryUserAssignedIdentity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource tags for the machine learning workspace. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the sku of the workspace. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Gets or sets the identity of the resource. + /// + [JsonProperty(PropertyName = "identity")] + public Identity Identity { get; set; } + + /// + /// Gets or sets the description of this workspace. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the friendly name for this workspace. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; set; } + + /// + /// Gets or sets the compute name for image build + /// + [JsonProperty(PropertyName = "properties.imageBuildCompute")] + public string ImageBuildCompute { get; set; } + + /// + /// Gets or sets the service managed resource settings. + /// + [JsonProperty(PropertyName = "properties.serviceManagedResourcesSettings")] + public ServiceManagedResourcesSettings ServiceManagedResourcesSettings { get; set; } + + /// + /// Gets or sets the user assigned identity resource id that represents + /// the workspace identity. + /// + [JsonProperty(PropertyName = "properties.primaryUserAssignedIdentity")] + public string PrimaryUserAssignedIdentity { get; set; } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/OnlineDeploymentsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/OnlineDeploymentsOperations.cs new file mode 100644 index 000000000000..f347c0753bd4 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/OnlineDeploymentsOperations.cs @@ -0,0 +1,1841 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// OnlineDeploymentsOperations operations. + /// + internal partial class OnlineDeploymentsOperations : IServiceOperations, IOnlineDeploymentsOperations + { + /// + /// Initializes a new instance of the OnlineDeploymentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OnlineDeploymentsOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// List Inference Endpoint Deployments. + /// + /// + /// Inference endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Top of list. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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 endpointName, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("orderBy", orderBy); + tracingParameters.Add("top", top); + tracingParameters.Add("skip", skip); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (orderBy != null) + { + _queryParameters.Add(string.Format("$orderBy={0}", System.Uri.EscapeDataString(orderBy))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + 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; + } + + /// + /// Delete Inference Endpoint Deployment (asynchronous). + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string endpointName, string deploymentName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(endpointName, deploymentName, resourceGroupName, workspaceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Inference Deployment Deployment. + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string deploymentName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Update Online Deployment (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string endpointName, string deploymentName, string resourceGroupName, string workspaceName, PartialOnlineDeploymentPartialTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update Inference Endpoint Deployment (asynchronous). + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Inference Endpoint entity to apply during operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string endpointName, string deploymentName, string resourceGroupName, string workspaceName, OnlineDeploymentTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Polls an Endpoint operation. + /// + /// + /// Inference endpoint name. + /// + /// + /// The name and identifier for the endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The request containing parameters for retrieving logs. + /// + /// + /// 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> GetLogsWithHttpMessagesAsync(string endpointName, string deploymentName, string resourceGroupName, string workspaceName, DeploymentLogsRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + 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("endpointName", endpointName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetLogs", 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.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}/getLogs").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete Inference Endpoint Deployment (asynchronous). + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string deploymentName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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; + } + + /// + /// Update Online Deployment (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during 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> BeginUpdateWithHttpMessagesAsync(string endpointName, string deploymentName, string resourceGroupName, string workspaceName, PartialOnlineDeploymentPartialTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (endpointName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(endpointName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "endpointName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + 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("endpointName", endpointName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update Inference Endpoint Deployment (asynchronous). + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Inference Endpoint entity to apply during 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> BeginCreateOrUpdateWithHttpMessagesAsync(string endpointName, string deploymentName, string resourceGroupName, string workspaceName, OnlineDeploymentTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (endpointName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(endpointName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "endpointName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + if (deploymentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName"); + } + if (deploymentName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("deploymentName", deploymentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + 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; + } + + /// + /// List Inference Endpoint Deployments. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/OnlineDeploymentsOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/OnlineDeploymentsOperationsExtensions.cs new file mode 100644 index 000000000000..88bed3cad353 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/OnlineDeploymentsOperationsExtensions.cs @@ -0,0 +1,569 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OnlineDeploymentsOperations. + /// + public static partial class OnlineDeploymentsOperationsExtensions + { + /// + /// List Inference Endpoint Deployments. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Top of list. + /// + /// + /// Continuation token for pagination. + /// + public static IPage List(this IOnlineDeploymentsOperations operations, string endpointName, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string)) + { + return operations.ListAsync(endpointName, resourceGroupName, workspaceName, orderBy, top, skip).GetAwaiter().GetResult(); + } + + /// + /// List Inference Endpoint Deployments. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Ordering of list. + /// + /// + /// Top of list. + /// + /// + /// Continuation token for pagination. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOnlineDeploymentsOperations operations, string endpointName, string resourceGroupName, string workspaceName, string orderBy = default(string), int? top = default(int?), string skip = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, orderBy, top, skip, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete Inference Endpoint Deployment (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static OnlineDeploymentsDeleteHeaders Delete(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName) + { + return operations.DeleteAsync(endpointName, deploymentName, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete Inference Endpoint Deployment (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(endpointName, deploymentName, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Get Inference Deployment Deployment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static OnlineDeploymentTrackedResource Get(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(endpointName, deploymentName, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Get Inference Deployment Deployment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(endpointName, deploymentName, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update Online Deployment (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during operation. + /// + public static OnlineDeploymentTrackedResource Update(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, PartialOnlineDeploymentPartialTrackedResource body) + { + return operations.UpdateAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Update Online Deployment (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, PartialOnlineDeploymentPartialTrackedResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update Inference Endpoint Deployment (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Inference Endpoint entity to apply during operation. + /// + public static OnlineDeploymentTrackedResource CreateOrUpdate(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, OnlineDeploymentTrackedResource body) + { + return operations.CreateOrUpdateAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update Inference Endpoint Deployment (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Inference Endpoint entity to apply during operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, OnlineDeploymentTrackedResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Polls an Endpoint operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name. + /// + /// + /// The name and identifier for the endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The request containing parameters for retrieving logs. + /// + public static DeploymentLogs GetLogs(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, DeploymentLogsRequest body) + { + return operations.GetLogsAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Polls an Endpoint operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name. + /// + /// + /// The name and identifier for the endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The request containing parameters for retrieving logs. + /// + /// + /// The cancellation token. + /// + public static async Task GetLogsAsync(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, DeploymentLogsRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetLogsWithHttpMessagesAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete Inference Endpoint Deployment (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static OnlineDeploymentsDeleteHeaders BeginDelete(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName) + { + return operations.BeginDeleteAsync(endpointName, deploymentName, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete Inference Endpoint Deployment (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(endpointName, deploymentName, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Update Online Deployment (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during operation. + /// + public static OnlineDeploymentTrackedResource BeginUpdate(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, PartialOnlineDeploymentPartialTrackedResource body) + { + return operations.BeginUpdateAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Update Online Deployment (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, PartialOnlineDeploymentPartialTrackedResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update Inference Endpoint Deployment (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Inference Endpoint entity to apply during operation. + /// + public static OnlineDeploymentTrackedResource BeginCreateOrUpdate(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, OnlineDeploymentTrackedResource body) + { + return operations.BeginCreateOrUpdateAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update Inference Endpoint Deployment (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Inference endpoint name. + /// + /// + /// Inference Endpoint Deployment name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Inference Endpoint entity to apply during operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IOnlineDeploymentsOperations operations, string endpointName, string deploymentName, string resourceGroupName, string workspaceName, OnlineDeploymentTrackedResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(endpointName, deploymentName, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List Inference Endpoint Deployments. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOnlineDeploymentsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List Inference Endpoint Deployments. + /// + /// + /// 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 IOnlineDeploymentsOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/OnlineEndpointsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/OnlineEndpointsOperations.cs new file mode 100644 index 000000000000..260fbe6d8286 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/OnlineEndpointsOperations.cs @@ -0,0 +1,2272 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// OnlineEndpointsOperations operations. + /// + internal partial class OnlineEndpointsOperations : IServiceOperations, IOnlineEndpointsOperations + { + /// + /// Initializes a new instance of the OnlineEndpointsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OnlineEndpointsOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// List Online Endpoints. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the endpoint. + /// + /// + /// Number of endpoints to be retrieved in a page of results. + /// + /// + /// EndpointComputeType to be filtered by. Possible values include: 'Managed', + /// 'K8S', 'AzureMLCompute' + /// + /// + /// Continuation token for pagination. + /// + /// + /// A set of tags with which to filter the returned models. It is a comma + /// separated string of tags key or tags key=value. Example: + /// tagKey1,tagKey2,tagKey3=value3 . + /// + /// + /// A set of properties with which to filter the returned models. It is a comma + /// separated string of properties key and/or properties key=value Example: + /// propKey1,propKey2,propKey3=value3 . + /// + /// + /// The option to order the response. Possible values include: 'CreatedAtDesc', + /// 'CreatedAtAsc', 'UpdatedAtDesc', 'UpdatedAtAsc' + /// + /// + /// 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 workspaceName, string name = default(string), int? count = default(int?), string computeType = default(string), string skip = default(string), string tags = default(string), string properties = default(string), string orderBy = default(string), 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("count", count); + tracingParameters.Add("computeType", computeType); + tracingParameters.Add("skip", skip); + tracingParameters.Add("tags", tags); + tracingParameters.Add("properties", properties); + tracingParameters.Add("orderBy", orderBy); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (name != null) + { + _queryParameters.Add(string.Format("name={0}", System.Uri.EscapeDataString(name))); + } + if (count != null) + { + _queryParameters.Add(string.Format("count={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(count, Client.SerializationSettings).Trim('"')))); + } + if (computeType != null) + { + _queryParameters.Add(string.Format("computeType={0}", System.Uri.EscapeDataString(computeType))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + if (tags != null) + { + _queryParameters.Add(string.Format("tags={0}", System.Uri.EscapeDataString(tags))); + } + if (properties != null) + { + _queryParameters.Add(string.Format("properties={0}", System.Uri.EscapeDataString(properties))); + } + if (orderBy != null) + { + _queryParameters.Add(string.Format("orderBy={0}", System.Uri.EscapeDataString(orderBy))); + } + 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; + } + + /// + /// Delete Online Endpoint (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Online Endpoint. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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; + } + + /// + /// Update Online Endpoint (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, PartialOnlineEndpointPartialTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update Online Endpoint (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, OnlineEndpointTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List EndpointAuthKeys for an Endpoint using Key-based authentication. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> ListKeysWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListKeys", 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.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/listKeys").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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; + } + + /// + /// Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication + /// (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// RegenerateKeys request . + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> RegenerateKeysWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, RegenerateEndpointKeysRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginRegenerateKeysWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve a valid AAD token for an Endpoint using AMLToken-based + /// authentication. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> GetTokenWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetToken", 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.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/token").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete Online Endpoint (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 endpointName, string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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; + } + + /// + /// Update Online Endpoint (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during 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> BeginUpdateWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, PartialOnlineEndpointPartialTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + 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("endpointName", endpointName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update Online Endpoint (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during 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> BeginCreateOrUpdateWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, OnlineEndpointTrackedResource body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + if (endpointName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(endpointName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")) + { + throw new ValidationException(ValidationRules.Pattern, "endpointName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$"); + } + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + 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; + } + + /// + /// Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication + /// (asynchronous). + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// RegenerateKeys request . + /// + /// + /// 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> BeginRegenerateKeysWithHttpMessagesAsync(string endpointName, string resourceGroupName, string workspaceName, RegenerateEndpointKeysRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (endpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointName"); + } + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointName", endpointName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRegenerateKeys", 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.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/regenerateKeys").ToString(); + _url = _url.Replace("{endpointName}", System.Uri.EscapeDataString(endpointName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new 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; + } + + /// + /// List Online Endpoints. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/OnlineEndpointsOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/OnlineEndpointsOperationsExtensions.cs new file mode 100644 index 000000000000..fb54c57b7d82 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/OnlineEndpointsOperationsExtensions.cs @@ -0,0 +1,701 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OnlineEndpointsOperations. + /// + public static partial class OnlineEndpointsOperationsExtensions + { + /// + /// List Online Endpoints. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the endpoint. + /// + /// + /// Number of endpoints to be retrieved in a page of results. + /// + /// + /// EndpointComputeType to be filtered by. Possible values include: 'Managed', + /// 'K8S', 'AzureMLCompute' + /// + /// + /// Continuation token for pagination. + /// + /// + /// A set of tags with which to filter the returned models. It is a comma + /// separated string of tags key or tags key=value. Example: + /// tagKey1,tagKey2,tagKey3=value3 . + /// + /// + /// A set of properties with which to filter the returned models. It is a comma + /// separated string of properties key and/or properties key=value Example: + /// propKey1,propKey2,propKey3=value3 . + /// + /// + /// The option to order the response. Possible values include: 'CreatedAtDesc', + /// 'CreatedAtAsc', 'UpdatedAtDesc', 'UpdatedAtAsc' + /// + public static IPage List(this IOnlineEndpointsOperations operations, string resourceGroupName, string workspaceName, string name = default(string), int? count = default(int?), string computeType = default(string), string skip = default(string), string tags = default(string), string properties = default(string), string orderBy = default(string)) + { + return operations.ListAsync(resourceGroupName, workspaceName, name, count, computeType, skip, tags, properties, orderBy).GetAwaiter().GetResult(); + } + + /// + /// List Online Endpoints. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Name of the endpoint. + /// + /// + /// Number of endpoints to be retrieved in a page of results. + /// + /// + /// EndpointComputeType to be filtered by. Possible values include: 'Managed', + /// 'K8S', 'AzureMLCompute' + /// + /// + /// Continuation token for pagination. + /// + /// + /// A set of tags with which to filter the returned models. It is a comma + /// separated string of tags key or tags key=value. Example: + /// tagKey1,tagKey2,tagKey3=value3 . + /// + /// + /// A set of properties with which to filter the returned models. It is a comma + /// separated string of properties key and/or properties key=value Example: + /// propKey1,propKey2,propKey3=value3 . + /// + /// + /// The option to order the response. Possible values include: 'CreatedAtDesc', + /// 'CreatedAtAsc', 'UpdatedAtDesc', 'UpdatedAtAsc' + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOnlineEndpointsOperations operations, string resourceGroupName, string workspaceName, string name = default(string), int? count = default(int?), string computeType = default(string), string skip = default(string), string tags = default(string), string properties = default(string), string orderBy = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, name, count, computeType, skip, tags, properties, orderBy, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete Online Endpoint (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static OnlineEndpointsDeleteHeaders Delete(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName) + { + return operations.DeleteAsync(endpointName, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete Online Endpoint (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Get Online Endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static OnlineEndpointTrackedResource Get(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(endpointName, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Get Online Endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update Online Endpoint (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during operation. + /// + public static OnlineEndpointTrackedResource Update(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, PartialOnlineEndpointPartialTrackedResource body) + { + return operations.UpdateAsync(endpointName, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Update Online Endpoint (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, PartialOnlineEndpointPartialTrackedResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update Online Endpoint (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during operation. + /// + public static OnlineEndpointTrackedResource CreateOrUpdate(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, OnlineEndpointTrackedResource body) + { + return operations.CreateOrUpdateAsync(endpointName, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update Online Endpoint (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, OnlineEndpointTrackedResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List EndpointAuthKeys for an Endpoint using Key-based authentication. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static EndpointAuthKeys ListKeys(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName) + { + return operations.ListKeysAsync(endpointName, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// List EndpointAuthKeys for an Endpoint using Key-based authentication. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task ListKeysAsync(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListKeysWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication + /// (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// RegenerateKeys request . + /// + public static OnlineEndpointsRegenerateKeysHeaders RegenerateKeys(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, RegenerateEndpointKeysRequest body) + { + return operations.RegenerateKeysAsync(endpointName, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication + /// (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// RegenerateKeys request . + /// + /// + /// The cancellation token. + /// + public static async Task RegenerateKeysAsync(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, RegenerateEndpointKeysRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RegenerateKeysWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Retrieve a valid AAD token for an Endpoint using AMLToken-based + /// authentication. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static EndpointAuthToken GetToken(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName) + { + return operations.GetTokenAsync(endpointName, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve a valid AAD token for an Endpoint using AMLToken-based + /// authentication. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetTokenAsync(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetTokenWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete Online Endpoint (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static OnlineEndpointsDeleteHeaders BeginDelete(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName) + { + return operations.BeginDeleteAsync(endpointName, resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Delete Online Endpoint (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Update Online Endpoint (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during operation. + /// + public static OnlineEndpointTrackedResource BeginUpdate(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, PartialOnlineEndpointPartialTrackedResource body) + { + return operations.BeginUpdateAsync(endpointName, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Update Online Endpoint (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, PartialOnlineEndpointPartialTrackedResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update Online Endpoint (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during operation. + /// + public static OnlineEndpointTrackedResource BeginCreateOrUpdate(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, OnlineEndpointTrackedResource body) + { + return operations.BeginCreateOrUpdateAsync(endpointName, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Create or update Online Endpoint (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Online Endpoint entity to apply during operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, OnlineEndpointTrackedResource body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication + /// (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// RegenerateKeys request . + /// + public static OnlineEndpointsRegenerateKeysHeaders BeginRegenerateKeys(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, RegenerateEndpointKeysRequest body) + { + return operations.BeginRegenerateKeysAsync(endpointName, resourceGroupName, workspaceName, body).GetAwaiter().GetResult(); + } + + /// + /// Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication + /// (asynchronous). + /// + /// + /// The operations group for this extension method. + /// + /// + /// Online Endpoint name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// RegenerateKeys request . + /// + /// + /// The cancellation token. + /// + public static async Task BeginRegenerateKeysAsync(this IOnlineEndpointsOperations operations, string endpointName, string resourceGroupName, string workspaceName, RegenerateEndpointKeysRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginRegenerateKeysWithHttpMessagesAsync(endpointName, resourceGroupName, workspaceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// List Online Endpoints. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOnlineEndpointsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List Online Endpoints. + /// + /// + /// 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 IOnlineEndpointsOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Operations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Operations.cs new file mode 100644 index 000000000000..beab2ccd8d43 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/Operations.cs @@ -0,0 +1,230 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// Lists all of the available Azure Machine Learning Workspaces REST API + /// operations. + /// + /// + /// 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.MachineLearningServices/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; + } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/OperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..08e4338586b4 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/OperationsExtensions.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Lists all of the available Azure Machine Learning Workspaces REST API + /// operations. + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available Azure Machine Learning Workspaces REST API + /// operations. + /// + /// + /// 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; + } + } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/PrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..5eae16266a19 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -0,0 +1,945 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// PrivateEndpointConnectionsOperations operations. + /// + internal partial class PrivateEndpointConnectionsOperations : IServiceOperations, IPrivateEndpointConnectionsOperations + { + /// + /// Initializes a new instance of the PrivateEndpointConnectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateEndpointConnectionsOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// List all the private endpoint connections associated with the workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + 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("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _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 the specified private endpoint connection associated with the + /// workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The name of the private endpoint connection associated with the workspace + /// + /// + /// 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 workspaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + 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.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + 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; + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The name of the private endpoint connection associated with the workspace + /// + /// + /// The private endpoint connection 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + 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 (properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + if (properties != null) + { + properties.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("workspaceName", workspaceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("properties", properties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + 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(properties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(properties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The name of the private endpoint connection associated with the workspace + /// + /// + /// 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 workspaceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + 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.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + 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; + } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs new file mode 100644 index 000000000000..ab9dedd2008f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs @@ -0,0 +1,214 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateEndpointConnectionsOperations. + /// + public static partial class PrivateEndpointConnectionsOperationsExtensions + { + /// + /// List all the private endpoint connections associated with the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static IEnumerable List(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName) + { + return operations.ListAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// List all the private endpoint connections associated with the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the specified private endpoint connection associated with the + /// workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The name of the private endpoint connection associated with the workspace + /// + public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) + { + return operations.GetAsync(resourceGroupName, workspaceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified private endpoint connection associated with the + /// workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The name of the private endpoint connection associated with the workspace + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The name of the private endpoint connection associated with the workspace + /// + /// + /// The private endpoint connection properties. + /// + public static PrivateEndpointConnection CreateOrUpdate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, PrivateEndpointConnection properties) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, privateEndpointConnectionName, properties).GetAwaiter().GetResult(); + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The name of the private endpoint connection associated with the workspace + /// + /// + /// The private endpoint connection properties. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, privateEndpointConnectionName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The name of the private endpoint connection associated with the workspace + /// + public static void Delete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) + { + operations.DeleteAsync(resourceGroupName, workspaceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The name of the private endpoint connection associated with the workspace + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/PrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..116e28bfee17 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/PrivateLinkResourcesOperations.cs @@ -0,0 +1,275 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// PrivateLinkResourcesOperations operations. + /// + internal partial class PrivateLinkResourcesOperations : IServiceOperations, IPrivateLinkResourcesOperations + { + /// + /// Initializes a new instance of the PrivateLinkResourcesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateLinkResourcesOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// Gets the private link resources that need to be created for a workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/privateLinkResources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/PrivateLinkResourcesOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/PrivateLinkResourcesOperationsExtensions.cs new file mode 100644 index 000000000000..86ffef32df9d --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/PrivateLinkResourcesOperationsExtensions.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.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateLinkResourcesOperations. + /// + public static partial class PrivateLinkResourcesOperationsExtensions + { + /// + /// Gets the private link resources that need to be created for a workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static PrivateLinkResourceListResult List(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string workspaceName) + { + return operations.ListAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the private link resources that need to be created for a workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/QuotasOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/QuotasOperations.cs new file mode 100644 index 000000000000..bcbbae60af8f --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/QuotasOperations.cs @@ -0,0 +1,642 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// QuotasOperations operations. + /// + internal partial class QuotasOperations : IServiceOperations, IQuotasOperations + { + /// + /// Initializes a new instance of the QuotasOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal QuotasOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// Update quota for each VM family in workspace. + /// + /// + /// The location for update quota is queried. + /// + /// + /// Quota update parameters. + /// + /// + /// 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 location, QuotaUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + 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("location", location); + tracingParameters.Add("parameters", parameters); + 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}/providers/Microsoft.MachineLearningServices/locations/{location}/updateQuotas").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 the currently assigned Workspace Quotas based on VMFamily. + /// + /// + /// The location for which resource usage is queried. + /// + /// + /// 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 location, 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 (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + 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.MachineLearningServices/locations/{location}/quotas").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the currently assigned Workspace Quotas based on VMFamily. + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/QuotasOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/QuotasOperationsExtensions.cs new file mode 100644 index 000000000000..fafdf2338eb4 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/QuotasOperationsExtensions.cs @@ -0,0 +1,133 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for QuotasOperations. + /// + public static partial class QuotasOperationsExtensions + { + /// + /// Update quota for each VM family in workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for update quota is queried. + /// + /// + /// Quota update parameters. + /// + public static UpdateWorkspaceQuotasResult Update(this IQuotasOperations operations, string location, QuotaUpdateParameters parameters) + { + return operations.UpdateAsync(location, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update quota for each VM family in workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for update quota is queried. + /// + /// + /// Quota update parameters. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IQuotasOperations operations, string location, QuotaUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(location, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the currently assigned Workspace Quotas based on VMFamily. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which resource usage is queried. + /// + public static IPage List(this IQuotasOperations operations, string location) + { + return operations.ListAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Gets the currently assigned Workspace Quotas based on VMFamily. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which resource usage is queried. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IQuotasOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the currently assigned Workspace Quotas based on VMFamily. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IQuotasOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the currently assigned Workspace Quotas based on VMFamily. + /// + /// + /// 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 IQuotasOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/SdkInfo_AzureMachineLearningWorkspaces.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/SdkInfo_AzureMachineLearningWorkspaces.cs new file mode 100644 index 000000000000..c4c828a857a2 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/SdkInfo_AzureMachineLearningWorkspaces.cs @@ -0,0 +1,52 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_AzureMachineLearningWorkspaces + { + get + { + return new Tuple[] + { + new Tuple("MachineLearningServices", "BatchDeployments", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "BatchEndpoints", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "CodeContainers", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "CodeVersions", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "Compute", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "DataContainers", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "DataVersions", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "Datastores", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "EnvironmentContainers", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "EnvironmentSpecificationVersions", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "Jobs", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "LabelingJobs", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "ModelContainers", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "ModelVersions", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "OnlineDeployments", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "OnlineEndpoints", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "Operations", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "PrivateEndpointConnections", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "PrivateLinkResources", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "Quotas", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "Usages", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "VirtualMachineSizes", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "WorkspaceConnections", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "WorkspaceFeatures", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "WorkspaceSkus", "2021-03-01-preview"), + new Tuple("MachineLearningServices", "Workspaces", "2021-03-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/UsagesOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/UsagesOperations.cs new file mode 100644 index 000000000000..b91f495acb5e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/UsagesOperations.cs @@ -0,0 +1,437 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// UsagesOperations operations. + /// + internal partial class UsagesOperations : IServiceOperations, IUsagesOperations + { + /// + /// Initializes a new instance of the UsagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal UsagesOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// Gets the current usage information as well as limits for AML resources for + /// given subscription and location. + /// + /// + /// The location for which resource usage is queried. + /// + /// + /// 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 location, 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 (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + 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.MachineLearningServices/locations/{location}/usages").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the current usage information as well as limits for AML resources for + /// given subscription and location. + /// + /// + /// 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/UsagesOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/UsagesOperationsExtensions.cs new file mode 100644 index 000000000000..f3fbb71e7a9b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/UsagesOperationsExtensions.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.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for UsagesOperations. + /// + public static partial class UsagesOperationsExtensions + { + /// + /// Gets the current usage information as well as limits for AML resources for + /// given subscription and location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which resource usage is queried. + /// + public static IPage List(this IUsagesOperations operations, string location) + { + return operations.ListAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Gets the current usage information as well as limits for AML resources for + /// given subscription and location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location for which resource usage is queried. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IUsagesOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the current usage information as well as limits for AML resources for + /// given subscription and location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IUsagesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the current usage information as well as limits for AML resources for + /// given subscription and location. + /// + /// + /// 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 IUsagesOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/VirtualMachineSizesOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/VirtualMachineSizesOperations.cs new file mode 100644 index 000000000000..f74ad1e0a34b --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/VirtualMachineSizesOperations.cs @@ -0,0 +1,262 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// VirtualMachineSizesOperations operations. + /// + internal partial class VirtualMachineSizesOperations : IServiceOperations, IVirtualMachineSizesOperations + { + /// + /// Initializes a new instance of the VirtualMachineSizesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualMachineSizesOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// Returns supported VM Sizes in a location + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// 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 location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + 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("location", location); + 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.MachineLearningServices/locations/{location}/vmSizes").ToString(); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/VirtualMachineSizesOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/VirtualMachineSizesOperationsExtensions.cs new file mode 100644 index 000000000000..d6b5f57d895e --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/VirtualMachineSizesOperationsExtensions.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.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualMachineSizesOperations. + /// + public static partial class VirtualMachineSizesOperationsExtensions + { + /// + /// Returns supported VM Sizes in a location + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + public static VirtualMachineSizeListResult List(this IVirtualMachineSizesOperations operations, string location) + { + return operations.ListAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Returns supported VM Sizes in a location + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location upon which virtual-machine-sizes is queried. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IVirtualMachineSizesOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceConnectionsOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceConnectionsOperations.cs new file mode 100644 index 000000000000..ba1ca1cc7914 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceConnectionsOperations.cs @@ -0,0 +1,954 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// WorkspaceConnectionsOperations operations. + /// + internal partial class WorkspaceConnectionsOperations : IServiceOperations, IWorkspaceConnectionsOperations + { + /// + /// Initializes a new instance of the WorkspaceConnectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WorkspaceConnectionsOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// List all connections under a AML workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Target of the workspace connection. + /// + /// + /// Category of the workspace connection. + /// + /// + /// 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 workspaceName, string target = default(string), string category = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("target", target); + tracingParameters.Add("category", category); + 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.MachineLearningServices/workspaces/{workspaceName}/connections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (target != null) + { + _queryParameters.Add(string.Format("target={0}", System.Uri.EscapeDataString(target))); + } + if (category != null) + { + _queryParameters.Add(string.Format("category={0}", System.Uri.EscapeDataString(category))); + } + 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; + } + + /// + /// Add a new workspace connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Friendly name of the workspace connection + /// + /// + /// The object for creating or updating a new workspace connection + /// + /// + /// 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 workspaceName, string connectionName, WorkspaceConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (connectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "connectionName"); + } + 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 (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("connectionName", connectionName); + tracingParameters.Add("parameters", parameters); + 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.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{connectionName}", System.Uri.EscapeDataString(connectionName)); + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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; + } + + /// + /// Get the detail of a workspace connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Friendly name of the workspace connection + /// + /// + /// 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 workspaceName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (connectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "connectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("connectionName", connectionName); + 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.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{connectionName}", System.Uri.EscapeDataString(connectionName)); + 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; + } + + /// + /// Delete a workspace connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Friendly name of the workspace connection + /// + /// + /// 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 workspaceName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (connectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "connectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("connectionName", connectionName); + 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.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{connectionName}", System.Uri.EscapeDataString(connectionName)); + 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; + } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceConnectionsOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceConnectionsOperationsExtensions.cs new file mode 100644 index 000000000000..3caa0c8e66f9 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceConnectionsOperationsExtensions.cs @@ -0,0 +1,220 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WorkspaceConnectionsOperations. + /// + public static partial class WorkspaceConnectionsOperationsExtensions + { + /// + /// List all connections under a AML workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Target of the workspace connection. + /// + /// + /// Category of the workspace connection. + /// + public static IEnumerable List(this IWorkspaceConnectionsOperations operations, string resourceGroupName, string workspaceName, string target = default(string), string category = default(string)) + { + return operations.ListAsync(resourceGroupName, workspaceName, target, category).GetAwaiter().GetResult(); + } + + /// + /// List all connections under a AML workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Target of the workspace connection. + /// + /// + /// Category of the workspace connection. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IWorkspaceConnectionsOperations operations, string resourceGroupName, string workspaceName, string target = default(string), string category = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, target, category, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Add a new workspace connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Friendly name of the workspace connection + /// + /// + /// The object for creating or updating a new workspace connection + /// + public static WorkspaceConnection Create(this IWorkspaceConnectionsOperations operations, string resourceGroupName, string workspaceName, string connectionName, WorkspaceConnection parameters) + { + return operations.CreateAsync(resourceGroupName, workspaceName, connectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Add a new workspace connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Friendly name of the workspace connection + /// + /// + /// The object for creating or updating a new workspace connection + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IWorkspaceConnectionsOperations operations, string resourceGroupName, string workspaceName, string connectionName, WorkspaceConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, workspaceName, connectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the detail of a workspace connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Friendly name of the workspace connection + /// + public static WorkspaceConnection Get(this IWorkspaceConnectionsOperations operations, string resourceGroupName, string workspaceName, string connectionName) + { + return operations.GetAsync(resourceGroupName, workspaceName, connectionName).GetAwaiter().GetResult(); + } + + /// + /// Get the detail of a workspace connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Friendly name of the workspace connection + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IWorkspaceConnectionsOperations operations, string resourceGroupName, string workspaceName, string connectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, connectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a workspace connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Friendly name of the workspace connection + /// + public static void Delete(this IWorkspaceConnectionsOperations operations, string resourceGroupName, string workspaceName, string connectionName) + { + operations.DeleteAsync(resourceGroupName, workspaceName, connectionName).GetAwaiter().GetResult(); + } + + /// + /// Delete a workspace connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// Friendly name of the workspace connection + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IWorkspaceConnectionsOperations operations, string resourceGroupName, string workspaceName, string connectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, connectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceFeaturesOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceFeaturesOperations.cs new file mode 100644 index 000000000000..1f1d39c554c0 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceFeaturesOperations.cs @@ -0,0 +1,438 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// WorkspaceFeaturesOperations operations. + /// + internal partial class WorkspaceFeaturesOperations : IServiceOperations, IWorkspaceFeaturesOperations + { + /// + /// Initializes a new instance of the WorkspaceFeaturesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WorkspaceFeaturesOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// Lists all enabled features for a workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 workspaceName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}/features").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 enabled features for a workspace + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceFeaturesOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceFeaturesOperationsExtensions.cs new file mode 100644 index 000000000000..a545cbd4ee69 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceFeaturesOperationsExtensions.cs @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WorkspaceFeaturesOperations. + /// + public static partial class WorkspaceFeaturesOperationsExtensions + { + /// + /// Lists all enabled features for a workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static IPage List(this IWorkspaceFeaturesOperations operations, string resourceGroupName, string workspaceName) + { + return operations.ListAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Lists all enabled features for a workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IWorkspaceFeaturesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all enabled features for a workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IWorkspaceFeaturesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all enabled features for a workspace + /// + /// + /// 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 IWorkspaceFeaturesOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceSkusOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceSkusOperations.cs new file mode 100644 index 000000000000..a7330c74e8ae --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceSkusOperations.cs @@ -0,0 +1,409 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// WorkspaceSkusOperations operations. + /// + internal partial class WorkspaceSkusOperations : IServiceOperations, IWorkspaceSkusOperations + { + /// + /// Initializes a new instance of the WorkspaceSkusOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WorkspaceSkusOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// Lists all skus with associated features + /// + /// + /// 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.MachineLearningServices/workspaces/skus").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all skus with associated features + /// + /// + /// 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceSkusOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceSkusOperationsExtensions.cs new file mode 100644 index 000000000000..d22b468c4c78 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspaceSkusOperationsExtensions.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.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WorkspaceSkusOperations. + /// + public static partial class WorkspaceSkusOperationsExtensions + { + /// + /// Lists all skus with associated features + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IWorkspaceSkusOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all skus with associated features + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IWorkspaceSkusOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all skus with associated features + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IWorkspaceSkusOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all skus with associated features + /// + /// + /// 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 IWorkspaceSkusOperations 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/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspacesOperations.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspacesOperations.cs new file mode 100644 index 000000000000..aa2002f81cba --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspacesOperations.cs @@ -0,0 +1,3054 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + 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; + + /// + /// WorkspacesOperations operations. + /// + internal partial class WorkspacesOperations : IServiceOperations, IWorkspacesOperations + { + /// + /// Initializes a new instance of the WorkspacesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WorkspacesOperations(AzureMachineLearningWorkspacesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureMachineLearningWorkspacesClient + /// + public AzureMachineLearningWorkspacesClient Client { get; private set; } + + /// + /// Gets the properties of the specified machine learning workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 workspaceName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 or updates a workspace with the specified parameters. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The parameters for creating or updating a machine learning workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a machine learning workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a machine learning workspace with the specified parameters. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The parameters for updating a machine learning workspace. + /// + /// + /// 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 workspaceName, WorkspaceUpdateParameters parameters, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("parameters", parameters); + 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.MachineLearningServices/workspaces/{workspaceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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; + } + + /// + /// Lists all the available machine learning workspaces under the specified + /// resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Continuation token for pagination. + /// + /// + /// 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, string skip = default(string), 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("skip", skip); + 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.MachineLearningServices/workspaces").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 (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + 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 keys associated with this workspace. This includes keys for + /// the storage account, app insights and password for container registry + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> ListKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListKeys", 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.MachineLearningServices/workspaces/{workspaceName}/listKeys").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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; + } + + /// + /// Resync all the keys associated with this workspace. This includes keys for + /// the storage account, app insights and password for container registry + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ResyncKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginResyncKeysWithHttpMessagesAsync(resourceGroupName, workspaceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all the available machine learning workspaces under the specified + /// subscription. + /// + /// + /// Continuation token for pagination. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(string skip = default(string), 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("skip", skip); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces").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 (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(skip))); + } + 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; + } + + /// + /// return notebook access token and refresh token + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> ListNotebookAccessTokenWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNotebookAccessToken", 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.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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; + } + + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> PrepareNotebookWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPrepareNotebookWithHttpMessagesAsync(resourceGroupName, workspaceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> ListStorageAccountKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListStorageAccountKeys", 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.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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; + } + + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> ListNotebookKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNotebookKeys", 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.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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 or updates a workspace with the specified parameters. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The parameters for creating or updating a machine learning workspace. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace parameters, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.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("workspaceName", workspaceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 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 machine learning workspace. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 workspaceName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + 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.MachineLearningServices/workspaces/{workspaceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Resync all the keys associated with this workspace. This includes keys for + /// the storage account, app insights and password for container registry + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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 BeginResyncKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginResyncKeys", 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.MachineLearningServices/workspaces/{workspaceName}/resyncKeys").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// 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> BeginPrepareNotebookWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPrepareNotebook", 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.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the available machine learning workspaces under 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; + } + + /// + /// Lists all the available machine learning workspaces under the specified + /// subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspacesOperationsExtensions.cs b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspacesOperationsExtensions.cs new file mode 100644 index 000000000000..b6cb004a9f22 --- /dev/null +++ b/sdk/machinelearningservices/Microsoft.Azure.Management.MachineLearningServices/src/Generated/WorkspacesOperationsExtensions.cs @@ -0,0 +1,723 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.MachineLearningServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WorkspacesOperations. + /// + public static partial class WorkspacesOperationsExtensions + { + /// + /// Gets the properties of the specified machine learning workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static Workspace Get(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + { + return operations.GetAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the properties of the specified machine learning workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a workspace with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The parameters for creating or updating a machine learning workspace. + /// + public static Workspace CreateOrUpdate(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a workspace with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The parameters for creating or updating a machine learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a machine learning workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void Delete(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + { + operations.DeleteAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a machine learning workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a machine learning workspace with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The parameters for updating a machine learning workspace. + /// + public static Workspace Update(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, WorkspaceUpdateParameters parameters) + { + return operations.UpdateAsync(resourceGroupName, workspaceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a machine learning workspace with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The parameters for updating a machine learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, WorkspaceUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the available machine learning workspaces under the specified + /// resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Continuation token for pagination. + /// + public static IPage ListByResourceGroup(this IWorkspacesOperations operations, string resourceGroupName, string skip = default(string)) + { + return operations.ListByResourceGroupAsync(resourceGroupName, skip).GetAwaiter().GetResult(); + } + + /// + /// Lists all the available machine learning workspaces under the specified + /// resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Continuation token for pagination. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IWorkspacesOperations operations, string resourceGroupName, string skip = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, skip, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the keys associated with this workspace. This includes keys for + /// the storage account, app insights and password for container registry + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static ListWorkspaceKeysResult ListKeys(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + { + return operations.ListKeysAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Lists all the keys associated with this workspace. This includes keys for + /// the storage account, app insights and password for container registry + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task ListKeysAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListKeysWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Resync all the keys associated with this workspace. This includes keys for + /// the storage account, app insights and password for container registry + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void ResyncKeys(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + { + operations.ResyncKeysAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Resync all the keys associated with this workspace. This includes keys for + /// the storage account, app insights and password for container registry + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task ResyncKeysAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ResyncKeysWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the available machine learning workspaces under the specified + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Continuation token for pagination. + /// + public static IPage ListBySubscription(this IWorkspacesOperations operations, string skip = default(string)) + { + return operations.ListBySubscriptionAsync(skip).GetAwaiter().GetResult(); + } + + /// + /// Lists all the available machine learning workspaces under the specified + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Continuation token for pagination. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IWorkspacesOperations operations, string skip = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(skip, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// return notebook access token and refresh token + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static NotebookAccessTokenResult ListNotebookAccessToken(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + { + return operations.ListNotebookAccessTokenAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// return notebook access token and refresh token + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task ListNotebookAccessTokenAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNotebookAccessTokenWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static NotebookResourceInfo PrepareNotebook(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + { + return operations.PrepareNotebookAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task PrepareNotebookAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PrepareNotebookWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static ListStorageAccountKeysResult ListStorageAccountKeys(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + { + return operations.ListStorageAccountKeysAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task ListStorageAccountKeysAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListStorageAccountKeysWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static ListNotebookKeysResult ListNotebookKeys(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + { + return operations.ListNotebookKeysAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task ListNotebookKeysAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNotebookKeysWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a workspace with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The parameters for creating or updating a machine learning workspace. + /// + public static Workspace BeginCreateOrUpdate(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, workspaceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a workspace with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The parameters for creating or updating a machine learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a machine learning workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void BeginDelete(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + { + operations.BeginDeleteAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a machine learning workspace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Resync all the keys associated with this workspace. This includes keys for + /// the storage account, app insights and password for container registry + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static void BeginResyncKeys(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + { + operations.BeginResyncKeysAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Resync all the keys associated with this workspace. This includes keys for + /// the storage account, app insights and password for container registry + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task BeginResyncKeysAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginResyncKeysWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + public static NotebookResourceInfo BeginPrepareNotebook(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + { + return operations.BeginPrepareNotebookAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Azure Machine Learning workspace. + /// + /// + /// The cancellation token. + /// + public static async Task BeginPrepareNotebookAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginPrepareNotebookWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the available machine learning workspaces under 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 IWorkspacesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the available machine learning workspaces under 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 IWorkspacesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the available machine learning workspaces under the specified + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IWorkspacesOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the available machine learning workspaces under the specified + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IWorkspacesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}