From ebd72794909c77410e38fb6e58193dae6f6c5901 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Sat, 16 May 2020 00:06:03 +0000 Subject: [PATCH] Update from master --- .../ContainerRegistryManagementClient.cs | 18 + .../Generated/ExportPipelinesOperations.cs | 1232 ++++++++++++++++ .../ExportPipelinesOperationsExtensions.cs | 338 +++++ .../IContainerRegistryManagementClient.cs | 15 + .../Generated/IExportPipelinesOperations.cs | 221 +++ .../Generated/IImportPipelinesOperations.cs | 221 +++ .../src/Generated/IPipelineRunsOperations.cs | 229 +++ .../src/Generated/IReplicationsOperations.cs | 36 +- .../Generated/ImportPipelinesOperations.cs | 1232 ++++++++++++++++ .../ImportPipelinesOperationsExtensions.cs | 338 +++++ .../src/Generated/Models/BaseImageTrigger.cs | 4 +- .../BaseImageTriggerUpdateParameters.cs | 4 +- .../src/Generated/Models/ExportPipeline.cs | 108 ++ .../Models/ExportPipelineTargetProperties.cs | 94 ++ .../src/Generated/Models/ImportPipeline.cs | 122 ++ .../Models/ImportPipelineSourceProperties.cs | 95 ++ .../src/Generated/Models/PipelineOptions.cs | 24 + .../src/Generated/Models/PipelineRun.cs | 103 ++ .../Generated/Models/PipelineRunRequest.cs | 101 ++ .../Generated/Models/PipelineRunResponse.cs | 150 ++ .../Models/PipelineRunSourceProperties.cs | 60 + .../Generated/Models/PipelineRunSourceType.cs | 21 + .../Models/PipelineRunTargetProperties.cs | 60 + .../Generated/Models/PipelineRunTargetType.cs | 21 + .../Models/PipelineSourceTriggerDescriptor.cs | 51 + .../Models/PipelineSourceTriggerProperties.cs | 66 + .../Generated/Models/PipelineSourceType.cs | 21 + .../Models/PipelineTriggerDescriptor.cs | 49 + .../Models/PipelineTriggerProperties.cs | 62 + .../Generated/Models/ProgressProperties.cs | 49 + .../Generated/Models/PublicNetworkAccess.cs | 22 + .../src/Generated/Models/Registry.cs | 14 +- .../Models/RegistryUpdateParameters.cs | 14 +- .../src/Generated/Models/Replication.cs | 17 +- .../Models/ReplicationUpdateParameters.cs | 20 +- .../src/Generated/Models/SourceTrigger.cs | 4 +- .../Models/SourceTriggerUpdateParameters.cs | 4 +- .../src/Generated/Models/TimerTrigger.cs | 4 +- .../Models/TimerTriggerUpdateParameters.cs | 4 +- .../src/Generated/Models/TriggerStatus.cs | 2 +- .../src/Generated/PipelineRunsOperations.cs | 1238 +++++++++++++++++ .../PipelineRunsOperationsExtensions.cs | 354 +++++ .../src/Generated/ReplicationsOperations.cs | 53 +- .../ReplicationsOperationsExtensions.cs | 84 +- ...kInfo_ContainerRegistryManagementClient.cs | 14 +- 45 files changed, 6883 insertions(+), 110 deletions(-) create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ExportPipelinesOperations.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ExportPipelinesOperationsExtensions.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IExportPipelinesOperations.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IImportPipelinesOperations.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IPipelineRunsOperations.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ImportPipelinesOperations.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ImportPipelinesOperationsExtensions.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ExportPipeline.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ExportPipelineTargetProperties.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ImportPipeline.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ImportPipelineSourceProperties.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineOptions.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRun.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunRequest.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunResponse.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunSourceProperties.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunSourceType.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunTargetProperties.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunTargetType.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineSourceTriggerDescriptor.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineSourceTriggerProperties.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineSourceType.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineTriggerDescriptor.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineTriggerProperties.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ProgressProperties.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PublicNetworkAccess.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/PipelineRunsOperations.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/PipelineRunsOperationsExtensions.cs diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ContainerRegistryManagementClient.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ContainerRegistryManagementClient.cs index bc8e78cde87dc..aef476e7690e7 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ContainerRegistryManagementClient.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ContainerRegistryManagementClient.cs @@ -66,16 +66,31 @@ public partial class ContainerRegistryManagementClient : ServiceClient public bool? GenerateClientRequestId { get; set; } + /// + /// Gets the IExportPipelinesOperations. + /// + public virtual IExportPipelinesOperations ExportPipelines { get; private set; } + /// /// Gets the IRegistriesOperations. /// public virtual IRegistriesOperations Registries { get; private set; } + /// + /// Gets the IImportPipelinesOperations. + /// + public virtual IImportPipelinesOperations ImportPipelines { get; private set; } + /// /// Gets the IOperations. /// public virtual IOperations Operations { get; private set; } + /// + /// Gets the IPipelineRunsOperations. + /// + public virtual IPipelineRunsOperations PipelineRuns { get; private set; } + /// /// Gets the IPrivateEndpointConnectionsOperations. /// @@ -362,8 +377,11 @@ public ContainerRegistryManagementClient(System.Uri baseUri, ServiceClientCreden /// private void Initialize() { + ExportPipelines = new ExportPipelinesOperations(this); Registries = new RegistriesOperations(this); + ImportPipelines = new ImportPipelinesOperations(this); Operations = new Operations(this); + PipelineRuns = new PipelineRunsOperations(this); PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); Replications = new ReplicationsOperations(this); Webhooks = new WebhooksOperations(this); diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ExportPipelinesOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ExportPipelinesOperations.cs new file mode 100644 index 0000000000000..80b8740ad2b1d --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ExportPipelinesOperations.cs @@ -0,0 +1,1232 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerRegistry +{ + 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; + + /// + /// ExportPipelinesOperations operations. + /// + internal partial class ExportPipelinesOperations : IServiceOperations, IExportPipelinesOperations + { + /// + /// Initializes a new instance of the ExportPipelinesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ExportPipelinesOperations(ContainerRegistryManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ContainerRegistryManagementClient + /// + public ContainerRegistryManagementClient Client { get; private set; } + + /// + /// Gets the properties of the export pipeline. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string registryName, string exportPipelineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (exportPipelineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exportPipelineName"); + } + if (exportPipelineName != null) + { + if (exportPipelineName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "exportPipelineName", 50); + } + if (exportPipelineName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "exportPipelineName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(exportPipelineName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "exportPipelineName", "^[a-zA-Z0-9]*$"); + } + } + string apiVersion = "2019-12-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + tracingParameters.Add("exportPipelineName", exportPipelineName); + 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.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{exportPipelineName}", System.Uri.EscapeDataString(exportPipelineName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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; + } + + /// + /// Creates an export pipeline for a container registry with the specified + /// parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// The parameters for creating an export pipeline. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string exportPipelineName, ExportPipeline exportPipelineCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, exportPipelineName, exportPipelineCreateParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an export pipeline from a container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string exportPipelineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, registryName, exportPipelineName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all export pipelines for the specified container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string registryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + string apiVersion = "2019-12-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + 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.ContainerRegistry/registries/{registryName}/exportPipelines").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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; + } + + /// + /// Creates an export pipeline for a container registry with the specified + /// parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// The parameters for creating an export pipeline. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string exportPipelineName, ExportPipeline exportPipelineCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (exportPipelineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exportPipelineName"); + } + if (exportPipelineName != null) + { + if (exportPipelineName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "exportPipelineName", 50); + } + if (exportPipelineName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "exportPipelineName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(exportPipelineName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "exportPipelineName", "^[a-zA-Z0-9]*$"); + } + } + if (exportPipelineCreateParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exportPipelineCreateParameters"); + } + if (exportPipelineCreateParameters != null) + { + exportPipelineCreateParameters.Validate(); + } + string apiVersion = "2019-12-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + tracingParameters.Add("exportPipelineName", exportPipelineName); + tracingParameters.Add("exportPipelineCreateParameters", exportPipelineCreateParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{exportPipelineName}", System.Uri.EscapeDataString(exportPipelineName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(exportPipelineCreateParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(exportPipelineCreateParameters, 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 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); + } + } + // 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 an export pipeline from a container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string exportPipelineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (exportPipelineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exportPipelineName"); + } + if (exportPipelineName != null) + { + if (exportPipelineName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "exportPipelineName", 50); + } + if (exportPipelineName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "exportPipelineName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(exportPipelineName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "exportPipelineName", "^[a-zA-Z0-9]*$"); + } + } + string apiVersion = "2019-12-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + tracingParameters.Add("exportPipelineName", exportPipelineName); + 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.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{exportPipelineName}", System.Uri.EscapeDataString(exportPipelineName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all export pipelines for the specified container registry. + /// + /// + /// 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 System.Threading.Tasks.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/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ExportPipelinesOperationsExtensions.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ExportPipelinesOperationsExtensions.cs new file mode 100644 index 0000000000000..252bfca65bd29 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ExportPipelinesOperationsExtensions.cs @@ -0,0 +1,338 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerRegistry +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + + /// + /// Extension methods for ExportPipelinesOperations. + /// + public static partial class ExportPipelinesOperationsExtensions + { + /// + /// Gets the properties of the export pipeline. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + public static ExportPipeline Get(this IExportPipelinesOperations operations, string resourceGroupName, string registryName, string exportPipelineName) + { + return operations.GetAsync(resourceGroupName, registryName, exportPipelineName).GetAwaiter().GetResult(); + } + + /// + /// Gets the properties of the export pipeline. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IExportPipelinesOperations operations, string resourceGroupName, string registryName, string exportPipelineName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, registryName, exportPipelineName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates an export pipeline for a container registry with the specified + /// parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// The parameters for creating an export pipeline. + /// + public static ExportPipeline Create(this IExportPipelinesOperations operations, string resourceGroupName, string registryName, string exportPipelineName, ExportPipeline exportPipelineCreateParameters) + { + return operations.CreateAsync(resourceGroupName, registryName, exportPipelineName, exportPipelineCreateParameters).GetAwaiter().GetResult(); + } + + /// + /// Creates an export pipeline for a container registry with the specified + /// parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// The parameters for creating an export pipeline. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateAsync(this IExportPipelinesOperations operations, string resourceGroupName, string registryName, string exportPipelineName, ExportPipeline exportPipelineCreateParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, registryName, exportPipelineName, exportPipelineCreateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an export pipeline from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + public static void Delete(this IExportPipelinesOperations operations, string resourceGroupName, string registryName, string exportPipelineName) + { + operations.DeleteAsync(resourceGroupName, registryName, exportPipelineName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an export pipeline from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IExportPipelinesOperations operations, string resourceGroupName, string registryName, string exportPipelineName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, registryName, exportPipelineName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all export pipelines for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + public static IPage List(this IExportPipelinesOperations operations, string resourceGroupName, string registryName) + { + return operations.ListAsync(resourceGroupName, registryName).GetAwaiter().GetResult(); + } + + /// + /// Lists all export pipelines for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IExportPipelinesOperations operations, string resourceGroupName, string registryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, registryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates an export pipeline for a container registry with the specified + /// parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// The parameters for creating an export pipeline. + /// + public static ExportPipeline BeginCreate(this IExportPipelinesOperations operations, string resourceGroupName, string registryName, string exportPipelineName, ExportPipeline exportPipelineCreateParameters) + { + return operations.BeginCreateAsync(resourceGroupName, registryName, exportPipelineName, exportPipelineCreateParameters).GetAwaiter().GetResult(); + } + + /// + /// Creates an export pipeline for a container registry with the specified + /// parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// The parameters for creating an export pipeline. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateAsync(this IExportPipelinesOperations operations, string resourceGroupName, string registryName, string exportPipelineName, ExportPipeline exportPipelineCreateParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, exportPipelineName, exportPipelineCreateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an export pipeline from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + public static void BeginDelete(this IExportPipelinesOperations operations, string resourceGroupName, string registryName, string exportPipelineName) + { + operations.BeginDeleteAsync(resourceGroupName, registryName, exportPipelineName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an export pipeline from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IExportPipelinesOperations operations, string resourceGroupName, string registryName, string exportPipelineName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, registryName, exportPipelineName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all export pipelines for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IExportPipelinesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all export pipelines for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IExportPipelinesOperations 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/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IContainerRegistryManagementClient.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IContainerRegistryManagementClient.cs index b6c74c0ee262f..1fe3ea64da17d 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IContainerRegistryManagementClient.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IContainerRegistryManagementClient.cs @@ -63,16 +63,31 @@ public partial interface IContainerRegistryManagementClient : System.IDisposable bool? GenerateClientRequestId { get; set; } + /// + /// Gets the IExportPipelinesOperations. + /// + IExportPipelinesOperations ExportPipelines { get; } + /// /// Gets the IRegistriesOperations. /// IRegistriesOperations Registries { get; } + /// + /// Gets the IImportPipelinesOperations. + /// + IImportPipelinesOperations ImportPipelines { get; } + /// /// Gets the IOperations. /// IOperations Operations { get; } + /// + /// Gets the IPipelineRunsOperations. + /// + IPipelineRunsOperations PipelineRuns { get; } + /// /// Gets the IPrivateEndpointConnectionsOperations. /// diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IExportPipelinesOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IExportPipelinesOperations.cs new file mode 100644 index 0000000000000..a8fc29370f523 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IExportPipelinesOperations.cs @@ -0,0 +1,221 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerRegistry +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + + /// + /// ExportPipelinesOperations operations. + /// + public partial interface IExportPipelinesOperations + { + /// + /// Gets the properties of the export pipeline. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string registryName, string exportPipelineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates an export pipeline for a container registry with the + /// specified parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// The parameters for creating an export pipeline. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string exportPipelineName, ExportPipeline exportPipelineCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an export pipeline from a container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string exportPipelineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all export pipelines for the specified container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string registryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates an export pipeline for a container registry with the + /// specified parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// The parameters for creating an export pipeline. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string exportPipelineName, ExportPipeline exportPipelineCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an export pipeline from a container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the export pipeline. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string exportPipelineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all export pipelines for the specified container registry. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IImportPipelinesOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IImportPipelinesOperations.cs new file mode 100644 index 0000000000000..83082e1e9694e --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IImportPipelinesOperations.cs @@ -0,0 +1,221 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerRegistry +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + + /// + /// ImportPipelinesOperations operations. + /// + public partial interface IImportPipelinesOperations + { + /// + /// Gets the properties of the import pipeline. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string registryName, string importPipelineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates an import pipeline for a container registry with the + /// specified parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// The parameters for creating an import pipeline. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string importPipelineName, ImportPipeline importPipelineCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an import pipeline from a container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string importPipelineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all import pipelines for the specified container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string registryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates an import pipeline for a container registry with the + /// specified parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// The parameters for creating an import pipeline. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string importPipelineName, ImportPipeline importPipelineCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an import pipeline from a container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string importPipelineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all import pipelines for the specified container registry. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IPipelineRunsOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IPipelineRunsOperations.cs new file mode 100644 index 0000000000000..2237e79d1f3a4 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IPipelineRunsOperations.cs @@ -0,0 +1,229 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerRegistry +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + + /// + /// PipelineRunsOperations operations. + /// + public partial interface IPipelineRunsOperations + { + /// + /// Gets the detailed information for a given pipeline run. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string registryName, string pipelineRunName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a pipeline run for a container registry with the specified + /// parameters + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// The request parameters for a pipeline run. + /// + /// + /// How the pipeline run should be forced to recreate even if the + /// pipeline run configuration has not changed. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string pipelineRunName, PipelineRunRequest request = default(PipelineRunRequest), string forceUpdateTag = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a pipeline run from a container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string pipelineRunName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the pipeline runs for the specified container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string registryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a pipeline run for a container registry with the specified + /// parameters + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// The request parameters for a pipeline run. + /// + /// + /// How the pipeline run should be forced to recreate even if the + /// pipeline run configuration has not changed. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string pipelineRunName, PipelineRunRequest request = default(PipelineRunRequest), string forceUpdateTag = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a pipeline run from a container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string pipelineRunName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the pipeline runs for the specified container registry. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IReplicationsOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IReplicationsOperations.cs index d8ef679dc2621..82c545f997895 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IReplicationsOperations.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IReplicationsOperations.cs @@ -65,12 +65,8 @@ public partial interface IReplicationsOperations /// /// The name of the replication. /// - /// - /// The location of the resource. This cannot be changed after the - /// resource is created. - /// - /// - /// The tags of the resource. + /// + /// The parameters for creating a replication. /// /// /// The headers that will be added to request. @@ -87,7 +83,7 @@ public partial interface IReplicationsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, string location, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, Replication replication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a replication from a container registry. /// @@ -131,6 +127,12 @@ public partial interface IReplicationsOperations /// /// The tags for the replication. /// + /// + /// Specifies whether the replication's regional endpoint is enabled. + /// Requests will not be routed to a replication whose regional + /// endpoint is disabled, however its data will continue to be synced + /// with other replications. + /// /// /// The headers that will be added to request. /// @@ -146,7 +148,7 @@ public partial interface IReplicationsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary), bool? regionEndpointEnabled = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all the replications for the specified container registry. /// @@ -187,12 +189,8 @@ public partial interface IReplicationsOperations /// /// The name of the replication. /// - /// - /// The location of the resource. This cannot be changed after the - /// resource is created. - /// - /// - /// The tags of the resource. + /// + /// The parameters for creating a replication. /// /// /// The headers that will be added to request. @@ -209,7 +207,7 @@ public partial interface IReplicationsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, string location, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, Replication replication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a replication from a container registry. /// @@ -253,6 +251,12 @@ public partial interface IReplicationsOperations /// /// The tags for the replication. /// + /// + /// Specifies whether the replication's regional endpoint is enabled. + /// Requests will not be routed to a replication whose regional + /// endpoint is disabled, however its data will continue to be synced + /// with other replications. + /// /// /// The headers that will be added to request. /// @@ -268,7 +272,7 @@ public partial interface IReplicationsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary), bool? regionEndpointEnabled = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all the replications for the specified container registry. /// diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ImportPipelinesOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ImportPipelinesOperations.cs new file mode 100644 index 0000000000000..fc2ea4219a99f --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ImportPipelinesOperations.cs @@ -0,0 +1,1232 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerRegistry +{ + 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; + + /// + /// ImportPipelinesOperations operations. + /// + internal partial class ImportPipelinesOperations : IServiceOperations, IImportPipelinesOperations + { + /// + /// Initializes a new instance of the ImportPipelinesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ImportPipelinesOperations(ContainerRegistryManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ContainerRegistryManagementClient + /// + public ContainerRegistryManagementClient Client { get; private set; } + + /// + /// Gets the properties of the import pipeline. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string registryName, string importPipelineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (importPipelineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "importPipelineName"); + } + if (importPipelineName != null) + { + if (importPipelineName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "importPipelineName", 50); + } + if (importPipelineName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "importPipelineName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(importPipelineName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "importPipelineName", "^[a-zA-Z0-9]*$"); + } + } + string apiVersion = "2019-12-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + tracingParameters.Add("importPipelineName", importPipelineName); + 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.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{importPipelineName}", System.Uri.EscapeDataString(importPipelineName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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; + } + + /// + /// Creates an import pipeline for a container registry with the specified + /// parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// The parameters for creating an import pipeline. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string importPipelineName, ImportPipeline importPipelineCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, importPipelineName, importPipelineCreateParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an import pipeline from a container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string importPipelineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, registryName, importPipelineName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all import pipelines for the specified container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string registryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + string apiVersion = "2019-12-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + 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.ContainerRegistry/registries/{registryName}/importPipelines").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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; + } + + /// + /// Creates an import pipeline for a container registry with the specified + /// parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// The parameters for creating an import pipeline. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string importPipelineName, ImportPipeline importPipelineCreateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (importPipelineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "importPipelineName"); + } + if (importPipelineName != null) + { + if (importPipelineName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "importPipelineName", 50); + } + if (importPipelineName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "importPipelineName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(importPipelineName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "importPipelineName", "^[a-zA-Z0-9]*$"); + } + } + if (importPipelineCreateParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "importPipelineCreateParameters"); + } + if (importPipelineCreateParameters != null) + { + importPipelineCreateParameters.Validate(); + } + string apiVersion = "2019-12-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + tracingParameters.Add("importPipelineName", importPipelineName); + tracingParameters.Add("importPipelineCreateParameters", importPipelineCreateParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{importPipelineName}", System.Uri.EscapeDataString(importPipelineName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(importPipelineCreateParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(importPipelineCreateParameters, 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 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); + } + } + // 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 an import pipeline from a container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string importPipelineName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (importPipelineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "importPipelineName"); + } + if (importPipelineName != null) + { + if (importPipelineName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "importPipelineName", 50); + } + if (importPipelineName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "importPipelineName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(importPipelineName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "importPipelineName", "^[a-zA-Z0-9]*$"); + } + } + string apiVersion = "2019-12-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + tracingParameters.Add("importPipelineName", importPipelineName); + 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.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{importPipelineName}", System.Uri.EscapeDataString(importPipelineName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all import pipelines for the specified container registry. + /// + /// + /// 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 System.Threading.Tasks.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/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ImportPipelinesOperationsExtensions.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ImportPipelinesOperationsExtensions.cs new file mode 100644 index 0000000000000..3a9d58b429cf0 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ImportPipelinesOperationsExtensions.cs @@ -0,0 +1,338 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerRegistry +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + + /// + /// Extension methods for ImportPipelinesOperations. + /// + public static partial class ImportPipelinesOperationsExtensions + { + /// + /// Gets the properties of the import pipeline. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + public static ImportPipeline Get(this IImportPipelinesOperations operations, string resourceGroupName, string registryName, string importPipelineName) + { + return operations.GetAsync(resourceGroupName, registryName, importPipelineName).GetAwaiter().GetResult(); + } + + /// + /// Gets the properties of the import pipeline. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IImportPipelinesOperations operations, string resourceGroupName, string registryName, string importPipelineName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, registryName, importPipelineName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates an import pipeline for a container registry with the specified + /// parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// The parameters for creating an import pipeline. + /// + public static ImportPipeline Create(this IImportPipelinesOperations operations, string resourceGroupName, string registryName, string importPipelineName, ImportPipeline importPipelineCreateParameters) + { + return operations.CreateAsync(resourceGroupName, registryName, importPipelineName, importPipelineCreateParameters).GetAwaiter().GetResult(); + } + + /// + /// Creates an import pipeline for a container registry with the specified + /// parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// The parameters for creating an import pipeline. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateAsync(this IImportPipelinesOperations operations, string resourceGroupName, string registryName, string importPipelineName, ImportPipeline importPipelineCreateParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, registryName, importPipelineName, importPipelineCreateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an import pipeline from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + public static void Delete(this IImportPipelinesOperations operations, string resourceGroupName, string registryName, string importPipelineName) + { + operations.DeleteAsync(resourceGroupName, registryName, importPipelineName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an import pipeline from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IImportPipelinesOperations operations, string resourceGroupName, string registryName, string importPipelineName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, registryName, importPipelineName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all import pipelines for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + public static IPage List(this IImportPipelinesOperations operations, string resourceGroupName, string registryName) + { + return operations.ListAsync(resourceGroupName, registryName).GetAwaiter().GetResult(); + } + + /// + /// Lists all import pipelines for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IImportPipelinesOperations operations, string resourceGroupName, string registryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, registryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates an import pipeline for a container registry with the specified + /// parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// The parameters for creating an import pipeline. + /// + public static ImportPipeline BeginCreate(this IImportPipelinesOperations operations, string resourceGroupName, string registryName, string importPipelineName, ImportPipeline importPipelineCreateParameters) + { + return operations.BeginCreateAsync(resourceGroupName, registryName, importPipelineName, importPipelineCreateParameters).GetAwaiter().GetResult(); + } + + /// + /// Creates an import pipeline for a container registry with the specified + /// parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// The parameters for creating an import pipeline. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateAsync(this IImportPipelinesOperations operations, string resourceGroupName, string registryName, string importPipelineName, ImportPipeline importPipelineCreateParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, importPipelineName, importPipelineCreateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an import pipeline from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + public static void BeginDelete(this IImportPipelinesOperations operations, string resourceGroupName, string registryName, string importPipelineName) + { + operations.BeginDeleteAsync(resourceGroupName, registryName, importPipelineName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an import pipeline from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the import pipeline. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IImportPipelinesOperations operations, string resourceGroupName, string registryName, string importPipelineName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, registryName, importPipelineName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all import pipelines for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IImportPipelinesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all import pipelines for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IImportPipelinesOperations 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/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/BaseImageTrigger.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/BaseImageTrigger.cs index 7d0a3d925649b..0f02163a99994 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/BaseImageTrigger.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/BaseImageTrigger.cs @@ -40,7 +40,7 @@ public BaseImageTrigger() /// Base image update triggers. Possible values include: 'Default', /// 'Token' /// The current status of trigger. Possible values - /// include: 'Disabled', 'Enabled' + /// include: 'Enabled', 'Disabled' public BaseImageTrigger(string baseImageTriggerType, string name, string updateTriggerEndpoint = default(string), string updateTriggerPayloadType = default(string), string status = default(string)) { BaseImageTriggerType = baseImageTriggerType; @@ -78,7 +78,7 @@ public BaseImageTrigger() /// /// Gets or sets the current status of trigger. Possible values - /// include: 'Disabled', 'Enabled' + /// include: 'Enabled', 'Disabled' /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/BaseImageTriggerUpdateParameters.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/BaseImageTriggerUpdateParameters.cs index 15c9593a64a6f..a7d2b3c695ff6 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/BaseImageTriggerUpdateParameters.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/BaseImageTriggerUpdateParameters.cs @@ -42,7 +42,7 @@ public BaseImageTriggerUpdateParameters() /// Base image update triggers. Possible values include: 'Default', /// 'Token' /// The current status of trigger. Possible values - /// include: 'Disabled', 'Enabled' + /// include: 'Enabled', 'Disabled' public BaseImageTriggerUpdateParameters(string name, string baseImageTriggerType = default(string), string updateTriggerEndpoint = default(string), string updateTriggerPayloadType = default(string), string status = default(string)) { BaseImageTriggerType = baseImageTriggerType; @@ -80,7 +80,7 @@ public BaseImageTriggerUpdateParameters() /// /// Gets or sets the current status of trigger. Possible values - /// include: 'Disabled', 'Enabled' + /// include: 'Enabled', 'Disabled' /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ExportPipeline.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ExportPipeline.cs new file mode 100644 index 0000000000000..c96f0133bb929 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ExportPipeline.cs @@ -0,0 +1,108 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerRegistry.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 an export pipeline for a container registry. + /// + [Rest.Serialization.JsonTransformation] + public partial class ExportPipeline : ProxyResource + { + /// + /// Initializes a new instance of the ExportPipeline class. + /// + public ExportPipeline() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExportPipeline class. + /// + /// The target properties of the export + /// pipeline. + /// The resource ID. + /// The name of the resource. + /// The type of the resource. + /// The identity of the export pipeline. + /// The list of all options configured for the + /// pipeline. + /// The provisioning state of the + /// pipeline at the time the operation was called. Possible values + /// include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', + /// 'Canceled' + public ExportPipeline(ExportPipelineTargetProperties target, string id = default(string), string name = default(string), string type = default(string), IdentityProperties identity = default(IdentityProperties), IList options = default(IList), string provisioningState = default(string)) + : base(id, name, type) + { + Identity = identity; + Target = target; + Options = options; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity of the export pipeline. + /// + [JsonProperty(PropertyName = "identity")] + public IdentityProperties Identity { get; set; } + + /// + /// Gets or sets the target properties of the export pipeline. + /// + [JsonProperty(PropertyName = "properties.target")] + public ExportPipelineTargetProperties Target { get; set; } + + /// + /// Gets or sets the list of all options configured for the pipeline. + /// + [JsonProperty(PropertyName = "properties.options")] + public IList Options { get; set; } + + /// + /// Gets the provisioning state of the pipeline at the time the + /// operation was called. Possible values include: 'Creating', + /// 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Target == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Target"); + } + if (Target != null) + { + Target.Validate(); + } + } + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ExportPipelineTargetProperties.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ExportPipelineTargetProperties.cs new file mode 100644 index 0000000000000..83ded1a7bca8e --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ExportPipelineTargetProperties.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.ContainerRegistry.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of the export pipeline target. + /// + public partial class ExportPipelineTargetProperties + { + /// + /// Initializes a new instance of the ExportPipelineTargetProperties + /// class. + /// + public ExportPipelineTargetProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExportPipelineTargetProperties + /// class. + /// + /// They key vault secret uri to obtain the + /// target storage SAS token. + /// The type of target for the export + /// pipeline. + /// The target uri of the export pipeline. + /// When 'AzureStorageBlob': + /// "https://accountName.blob.core.windows.net/containerName/blobName" + /// When 'AzureStorageBlobContainer': + /// "https://accountName.blob.core.windows.net/containerName" + public ExportPipelineTargetProperties(string keyVaultUri, string type = default(string), string uri = default(string)) + { + Type = type; + Uri = uri; + KeyVaultUri = keyVaultUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of target for the export pipeline. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the target uri of the export pipeline. + /// When 'AzureStorageBlob': + /// "https://accountName.blob.core.windows.net/containerName/blobName" + /// When 'AzureStorageBlobContainer': + /// "https://accountName.blob.core.windows.net/containerName" + /// + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + + /// + /// Gets or sets they key vault secret uri to obtain the target storage + /// SAS token. + /// + [JsonProperty(PropertyName = "keyVaultUri")] + public string KeyVaultUri { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KeyVaultUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyVaultUri"); + } + } + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ImportPipeline.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ImportPipeline.cs new file mode 100644 index 0000000000000..43636dc8b9d19 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ImportPipeline.cs @@ -0,0 +1,122 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerRegistry.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 an import pipeline for a container registry. + /// + [Rest.Serialization.JsonTransformation] + public partial class ImportPipeline : ProxyResource + { + /// + /// Initializes a new instance of the ImportPipeline class. + /// + public ImportPipeline() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImportPipeline class. + /// + /// The source properties of the import + /// pipeline. + /// The resource ID. + /// The name of the resource. + /// The type of the resource. + /// The identity of the import pipeline. + /// The properties that describe the trigger of + /// the import pipeline. + /// The list of all options configured for the + /// pipeline. + /// The provisioning state of the + /// pipeline at the time the operation was called. Possible values + /// include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', + /// 'Canceled' + public ImportPipeline(ImportPipelineSourceProperties source, string id = default(string), string name = default(string), string type = default(string), IdentityProperties identity = default(IdentityProperties), PipelineTriggerProperties trigger = default(PipelineTriggerProperties), IList options = default(IList), string provisioningState = default(string)) + : base(id, name, type) + { + Identity = identity; + Source = source; + Trigger = trigger; + Options = options; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity of the import pipeline. + /// + [JsonProperty(PropertyName = "identity")] + public IdentityProperties Identity { get; set; } + + /// + /// Gets or sets the source properties of the import pipeline. + /// + [JsonProperty(PropertyName = "properties.source")] + public ImportPipelineSourceProperties Source { get; set; } + + /// + /// Gets or sets the properties that describe the trigger of the import + /// pipeline. + /// + [JsonProperty(PropertyName = "properties.trigger")] + public PipelineTriggerProperties Trigger { get; set; } + + /// + /// Gets or sets the list of all options configured for the pipeline. + /// + [JsonProperty(PropertyName = "properties.options")] + public IList Options { get; set; } + + /// + /// Gets the provisioning state of the pipeline at the time the + /// operation was called. Possible values include: 'Creating', + /// 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Source == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Source"); + } + if (Source != null) + { + Source.Validate(); + } + if (Trigger != null) + { + Trigger.Validate(); + } + } + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ImportPipelineSourceProperties.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ImportPipelineSourceProperties.cs new file mode 100644 index 0000000000000..70d4711067f76 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ImportPipelineSourceProperties.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.ContainerRegistry.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of the import pipeline source. + /// + public partial class ImportPipelineSourceProperties + { + /// + /// Initializes a new instance of the ImportPipelineSourceProperties + /// class. + /// + public ImportPipelineSourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImportPipelineSourceProperties + /// class. + /// + /// They key vault secret uri to obtain the + /// source storage SAS token. + /// The type of source for the import pipeline. + /// Possible values include: 'AzureStorageBlobContainer' + /// The source uri of the import pipeline. + /// When 'AzureStorageBlob': + /// "https://accountName.blob.core.windows.net/containerName/blobName" + /// When 'AzureStorageBlobContainer': + /// "https://accountName.blob.core.windows.net/containerName" + public ImportPipelineSourceProperties(string keyVaultUri, string type = default(string), string uri = default(string)) + { + Type = type; + Uri = uri; + KeyVaultUri = keyVaultUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of source for the import pipeline. Possible + /// values include: 'AzureStorageBlobContainer' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the source uri of the import pipeline. + /// When 'AzureStorageBlob': + /// "https://accountName.blob.core.windows.net/containerName/blobName" + /// When 'AzureStorageBlobContainer': + /// "https://accountName.blob.core.windows.net/containerName" + /// + [JsonProperty(PropertyName = "uri")] + public string Uri { get; set; } + + /// + /// Gets or sets they key vault secret uri to obtain the source storage + /// SAS token. + /// + [JsonProperty(PropertyName = "keyVaultUri")] + public string KeyVaultUri { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KeyVaultUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KeyVaultUri"); + } + } + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineOptions.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineOptions.cs new file mode 100644 index 0000000000000..b5861e4d9cd78 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineOptions.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.ContainerRegistry.Models +{ + + /// + /// Defines values for PipelineOptions. + /// + public static class PipelineOptions + { + public const string OverwriteTags = "OverwriteTags"; + public const string OverwriteBlobs = "OverwriteBlobs"; + public const string DeleteSourceBlobOnSuccess = "DeleteSourceBlobOnSuccess"; + public const string ContinueOnErrors = "ContinueOnErrors"; + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRun.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRun.cs new file mode 100644 index 0000000000000..f6fc687cdcdf4 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRun.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.ContainerRegistry.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An object that represents a pipeline run for a container registry. + /// + [Rest.Serialization.JsonTransformation] + public partial class PipelineRun : ProxyResource + { + /// + /// Initializes a new instance of the PipelineRun class. + /// + public PipelineRun() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PipelineRun class. + /// + /// The resource ID. + /// The name of the resource. + /// The type of the resource. + /// The provisioning state of a + /// pipeline run. Possible values include: 'Creating', 'Updating', + /// 'Deleting', 'Succeeded', 'Failed', 'Canceled' + /// The request parameters for a pipeline + /// run. + /// The response of a pipeline run. + /// How the pipeline run should be forced + /// to recreate even if the pipeline run configuration has not + /// changed. + public PipelineRun(string id = default(string), string name = default(string), string type = default(string), string provisioningState = default(string), PipelineRunRequest request = default(PipelineRunRequest), PipelineRunResponse response = default(PipelineRunResponse), string forceUpdateTag = default(string)) + : base(id, name, type) + { + ProvisioningState = provisioningState; + Request = request; + Response = response; + ForceUpdateTag = forceUpdateTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the provisioning state of a pipeline run. Possible values + /// include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', + /// 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the request parameters for a pipeline run. + /// + [JsonProperty(PropertyName = "properties.request")] + public PipelineRunRequest Request { get; set; } + + /// + /// Gets the response of a pipeline run. + /// + [JsonProperty(PropertyName = "properties.response")] + public PipelineRunResponse Response { get; private set; } + + /// + /// Gets or sets how the pipeline run should be forced to recreate even + /// if the pipeline run configuration has not changed. + /// + [JsonProperty(PropertyName = "properties.forceUpdateTag")] + public string ForceUpdateTag { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Response != null) + { + Response.Validate(); + } + } + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunRequest.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunRequest.cs new file mode 100644 index 0000000000000..f4243732926f0 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunRequest.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.ContainerRegistry.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The request properties provided for a pipeline run. + /// + public partial class PipelineRunRequest + { + /// + /// Initializes a new instance of the PipelineRunRequest class. + /// + public PipelineRunRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PipelineRunRequest class. + /// + /// The resource ID of the pipeline to + /// run. + /// List of source artifacts to be transferred + /// by the pipeline. + /// Specify an image by repository ('hello-world'). This will use the + /// 'latest' tag. + /// Specify an image by tag ('hello-world:latest'). + /// Specify an image by sha256-based manifest digest + /// ('hello-world@sha256:abc123'). + /// The source properties of the pipeline + /// run. + /// The target properties of the pipeline + /// run. + /// The digest of the tar used to transfer + /// the artifacts. + public PipelineRunRequest(string pipelineResourceId = default(string), IList artifacts = default(IList), PipelineRunSourceProperties source = default(PipelineRunSourceProperties), PipelineRunTargetProperties target = default(PipelineRunTargetProperties), string catalogDigest = default(string)) + { + PipelineResourceId = pipelineResourceId; + Artifacts = artifacts; + Source = source; + Target = target; + CatalogDigest = catalogDigest; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the pipeline to run. + /// + [JsonProperty(PropertyName = "pipelineResourceId")] + public string PipelineResourceId { get; set; } + + /// + /// Gets or sets list of source artifacts to be transferred by the + /// pipeline. + /// Specify an image by repository ('hello-world'). This will use the + /// 'latest' tag. + /// Specify an image by tag ('hello-world:latest'). + /// Specify an image by sha256-based manifest digest + /// ('hello-world@sha256:abc123'). + /// + [JsonProperty(PropertyName = "artifacts")] + public IList Artifacts { get; set; } + + /// + /// Gets or sets the source properties of the pipeline run. + /// + [JsonProperty(PropertyName = "source")] + public PipelineRunSourceProperties Source { get; set; } + + /// + /// Gets or sets the target properties of the pipeline run. + /// + [JsonProperty(PropertyName = "target")] + public PipelineRunTargetProperties Target { get; set; } + + /// + /// Gets or sets the digest of the tar used to transfer the artifacts. + /// + [JsonProperty(PropertyName = "catalogDigest")] + public string CatalogDigest { get; set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunResponse.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunResponse.cs new file mode 100644 index 0000000000000..ba7b97f5bbda5 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunResponse.cs @@ -0,0 +1,150 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerRegistry.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The response properties returned for a pipeline run. + /// + public partial class PipelineRunResponse + { + /// + /// Initializes a new instance of the PipelineRunResponse class. + /// + public PipelineRunResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PipelineRunResponse class. + /// + /// The current status of the pipeline + /// run. + /// The artifacts imported in the + /// pipeline run. + /// The current progress of the copy + /// operation. + /// The time the pipeline run started. + /// The time the pipeline run + /// finished. + /// The source of the pipeline run. + /// The target of the pipeline run. + /// The digest of the tar used to transfer + /// the artifacts. + /// The trigger that caused the pipeline + /// run. + /// The detailed error message + /// for the pipeline run in the case of failure. + public PipelineRunResponse(string status = default(string), IList importedArtifacts = default(IList), ProgressProperties progress = default(ProgressProperties), System.DateTime? startTime = default(System.DateTime?), System.DateTime? finishTime = default(System.DateTime?), ImportPipelineSourceProperties source = default(ImportPipelineSourceProperties), ExportPipelineTargetProperties target = default(ExportPipelineTargetProperties), string catalogDigest = default(string), PipelineTriggerDescriptor trigger = default(PipelineTriggerDescriptor), string pipelineRunErrorMessage = default(string)) + { + Status = status; + ImportedArtifacts = importedArtifacts; + Progress = progress; + StartTime = startTime; + FinishTime = finishTime; + Source = source; + Target = target; + CatalogDigest = catalogDigest; + Trigger = trigger; + PipelineRunErrorMessage = pipelineRunErrorMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the current status of the pipeline run. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the artifacts imported in the pipeline run. + /// + [JsonProperty(PropertyName = "importedArtifacts")] + public IList ImportedArtifacts { get; set; } + + /// + /// Gets or sets the current progress of the copy operation. + /// + [JsonProperty(PropertyName = "progress")] + public ProgressProperties Progress { get; set; } + + /// + /// Gets or sets the time the pipeline run started. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + /// + /// Gets or sets the time the pipeline run finished. + /// + [JsonProperty(PropertyName = "finishTime")] + public System.DateTime? FinishTime { get; set; } + + /// + /// Gets or sets the source of the pipeline run. + /// + [JsonProperty(PropertyName = "source")] + public ImportPipelineSourceProperties Source { get; set; } + + /// + /// Gets or sets the target of the pipeline run. + /// + [JsonProperty(PropertyName = "target")] + public ExportPipelineTargetProperties Target { get; set; } + + /// + /// Gets or sets the digest of the tar used to transfer the artifacts. + /// + [JsonProperty(PropertyName = "catalogDigest")] + public string CatalogDigest { get; set; } + + /// + /// Gets or sets the trigger that caused the pipeline run. + /// + [JsonProperty(PropertyName = "trigger")] + public PipelineTriggerDescriptor Trigger { get; set; } + + /// + /// Gets or sets the detailed error message for the pipeline run in the + /// case of failure. + /// + [JsonProperty(PropertyName = "pipelineRunErrorMessage")] + public string PipelineRunErrorMessage { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Source != null) + { + Source.Validate(); + } + if (Target != null) + { + Target.Validate(); + } + } + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunSourceProperties.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunSourceProperties.cs new file mode 100644 index 0000000000000..879c0083ec86d --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunSourceProperties.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.ContainerRegistry.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class PipelineRunSourceProperties + { + /// + /// Initializes a new instance of the PipelineRunSourceProperties + /// class. + /// + public PipelineRunSourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PipelineRunSourceProperties + /// class. + /// + /// The type of the source. Possible values include: + /// 'AzureStorageBlob' + /// The name of the source. + public PipelineRunSourceProperties(string type = default(string), string name = default(string)) + { + Type = type; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of the source. Possible values include: + /// 'AzureStorageBlob' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the name of the source. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunSourceType.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunSourceType.cs new file mode 100644 index 0000000000000..ea27aeb95f3f7 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunSourceType.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.ContainerRegistry.Models +{ + + /// + /// Defines values for PipelineRunSourceType. + /// + public static class PipelineRunSourceType + { + public const string AzureStorageBlob = "AzureStorageBlob"; + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunTargetProperties.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunTargetProperties.cs new file mode 100644 index 0000000000000..97452993008f0 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunTargetProperties.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.ContainerRegistry.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class PipelineRunTargetProperties + { + /// + /// Initializes a new instance of the PipelineRunTargetProperties + /// class. + /// + public PipelineRunTargetProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PipelineRunTargetProperties + /// class. + /// + /// The type of the target. Possible values include: + /// 'AzureStorageBlob' + /// The name of the target. + public PipelineRunTargetProperties(string type = default(string), string name = default(string)) + { + Type = type; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of the target. Possible values include: + /// 'AzureStorageBlob' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the name of the target. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunTargetType.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunTargetType.cs new file mode 100644 index 0000000000000..cd4a4a1d79253 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineRunTargetType.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.ContainerRegistry.Models +{ + + /// + /// Defines values for PipelineRunTargetType. + /// + public static class PipelineRunTargetType + { + public const string AzureStorageBlob = "AzureStorageBlob"; + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineSourceTriggerDescriptor.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineSourceTriggerDescriptor.cs new file mode 100644 index 0000000000000..7d689a6c7113f --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineSourceTriggerDescriptor.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.ContainerRegistry.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class PipelineSourceTriggerDescriptor + { + /// + /// Initializes a new instance of the PipelineSourceTriggerDescriptor + /// class. + /// + public PipelineSourceTriggerDescriptor() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PipelineSourceTriggerDescriptor + /// class. + /// + /// The timestamp when the source update + /// happened. + public PipelineSourceTriggerDescriptor(System.DateTime? timestamp = default(System.DateTime?)) + { + Timestamp = timestamp; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the timestamp when the source update happened. + /// + [JsonProperty(PropertyName = "timestamp")] + public System.DateTime? Timestamp { get; set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineSourceTriggerProperties.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineSourceTriggerProperties.cs new file mode 100644 index 0000000000000..2ef545e96b789 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineSourceTriggerProperties.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.ContainerRegistry.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + public partial class PipelineSourceTriggerProperties + { + /// + /// Initializes a new instance of the PipelineSourceTriggerProperties + /// class. + /// + public PipelineSourceTriggerProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PipelineSourceTriggerProperties + /// class. + /// + /// The current status of the source trigger. + /// Possible values include: 'Enabled', 'Disabled' + public PipelineSourceTriggerProperties(string status) + { + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the current status of the source trigger. Possible + /// values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Status == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + } + } + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineSourceType.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineSourceType.cs new file mode 100644 index 0000000000000..11135f3778e44 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineSourceType.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.ContainerRegistry.Models +{ + + /// + /// Defines values for PipelineSourceType. + /// + public static class PipelineSourceType + { + public const string AzureStorageBlobContainer = "AzureStorageBlobContainer"; + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineTriggerDescriptor.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineTriggerDescriptor.cs new file mode 100644 index 0000000000000..a3c074e252764 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineTriggerDescriptor.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.ContainerRegistry.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class PipelineTriggerDescriptor + { + /// + /// Initializes a new instance of the PipelineTriggerDescriptor class. + /// + public PipelineTriggerDescriptor() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PipelineTriggerDescriptor class. + /// + /// The source trigger that caused the + /// pipeline run. + public PipelineTriggerDescriptor(PipelineSourceTriggerDescriptor sourceTrigger = default(PipelineSourceTriggerDescriptor)) + { + SourceTrigger = sourceTrigger; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the source trigger that caused the pipeline run. + /// + [JsonProperty(PropertyName = "sourceTrigger")] + public PipelineSourceTriggerDescriptor SourceTrigger { get; set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineTriggerProperties.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineTriggerProperties.cs new file mode 100644 index 0000000000000..1bf32b1e75efd --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PipelineTriggerProperties.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.ContainerRegistry.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class PipelineTriggerProperties + { + /// + /// Initializes a new instance of the PipelineTriggerProperties class. + /// + public PipelineTriggerProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PipelineTriggerProperties class. + /// + /// The source trigger properties of the + /// pipeline. + public PipelineTriggerProperties(PipelineSourceTriggerProperties sourceTrigger = default(PipelineSourceTriggerProperties)) + { + SourceTrigger = sourceTrigger; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the source trigger properties of the pipeline. + /// + [JsonProperty(PropertyName = "sourceTrigger")] + public PipelineSourceTriggerProperties SourceTrigger { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SourceTrigger != null) + { + SourceTrigger.Validate(); + } + } + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ProgressProperties.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ProgressProperties.cs new file mode 100644 index 0000000000000..8eb6bd01f24cf --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ProgressProperties.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.ContainerRegistry.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ProgressProperties + { + /// + /// Initializes a new instance of the ProgressProperties class. + /// + public ProgressProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProgressProperties class. + /// + /// The percentage complete of the copy + /// operation. + public ProgressProperties(string percentage = default(string)) + { + Percentage = percentage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the percentage complete of the copy operation. + /// + [JsonProperty(PropertyName = "percentage")] + public string Percentage { get; set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PublicNetworkAccess.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PublicNetworkAccess.cs new file mode 100644 index 0000000000000..bea9f198533ba --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/PublicNetworkAccess.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.ContainerRegistry.Models +{ + + /// + /// Defines values for PublicNetworkAccess. + /// + public static class PublicNetworkAccess + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Registry.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Registry.cs index f4dd14e7a48fb..c0349a967ee80 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Registry.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Registry.cs @@ -69,7 +69,10 @@ public Registry() /// serve data when dataEndpointEnabled is true. /// List of private endpoint /// connections for a container registry. - public Registry(string location, Sku sku, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IdentityProperties identity = default(IdentityProperties), string loginServer = default(string), System.DateTime? creationDate = default(System.DateTime?), string provisioningState = default(string), Status status = default(Status), bool? adminUserEnabled = default(bool?), StorageAccountProperties storageAccount = default(StorageAccountProperties), NetworkRuleSet networkRuleSet = default(NetworkRuleSet), Policies policies = default(Policies), EncryptionProperty encryption = default(EncryptionProperty), bool? dataEndpointEnabled = default(bool?), IList dataEndpointHostNames = default(IList), IList privateEndpointConnections = default(IList)) + /// Whether or not public network + /// access is allowed for the container registry. Possible values + /// include: 'Enabled', 'Disabled' + public Registry(string location, Sku sku, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IdentityProperties identity = default(IdentityProperties), string loginServer = default(string), System.DateTime? creationDate = default(System.DateTime?), string provisioningState = default(string), Status status = default(Status), bool? adminUserEnabled = default(bool?), StorageAccountProperties storageAccount = default(StorageAccountProperties), NetworkRuleSet networkRuleSet = default(NetworkRuleSet), Policies policies = default(Policies), EncryptionProperty encryption = default(EncryptionProperty), bool? dataEndpointEnabled = default(bool?), IList dataEndpointHostNames = default(IList), IList privateEndpointConnections = default(IList), string publicNetworkAccess = default(string)) : base(location, id, name, type, tags) { Sku = sku; @@ -86,6 +89,7 @@ public Registry() DataEndpointEnabled = dataEndpointEnabled; DataEndpointHostNames = dataEndpointHostNames; PrivateEndpointConnections = privateEndpointConnections; + PublicNetworkAccess = publicNetworkAccess; CustomInit(); } @@ -185,6 +189,14 @@ public Registry() [JsonProperty(PropertyName = "properties.privateEndpointConnections")] public IList PrivateEndpointConnections { get; private set; } + /// + /// Gets or sets whether or not public network access is allowed for + /// the container registry. Possible values include: 'Enabled', + /// 'Disabled' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RegistryUpdateParameters.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RegistryUpdateParameters.cs index 21be6da70dce1..8154ddfae8a9f 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RegistryUpdateParameters.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RegistryUpdateParameters.cs @@ -48,7 +48,10 @@ public RegistryUpdateParameters() /// registry. /// Enable a single data endpoint per /// region for serving data. - public RegistryUpdateParameters(IDictionary tags = default(IDictionary), Sku sku = default(Sku), IdentityProperties identity = default(IdentityProperties), bool? adminUserEnabled = default(bool?), NetworkRuleSet networkRuleSet = default(NetworkRuleSet), Policies policies = default(Policies), EncryptionProperty encryption = default(EncryptionProperty), bool? dataEndpointEnabled = default(bool?)) + /// Whether or not public network + /// access is allowed for the container registry. Possible values + /// include: 'Enabled', 'Disabled' + public RegistryUpdateParameters(IDictionary tags = default(IDictionary), Sku sku = default(Sku), IdentityProperties identity = default(IdentityProperties), bool? adminUserEnabled = default(bool?), NetworkRuleSet networkRuleSet = default(NetworkRuleSet), Policies policies = default(Policies), EncryptionProperty encryption = default(EncryptionProperty), bool? dataEndpointEnabled = default(bool?), string publicNetworkAccess = default(string)) { Tags = tags; Sku = sku; @@ -58,6 +61,7 @@ public RegistryUpdateParameters() Policies = policies; Encryption = encryption; DataEndpointEnabled = dataEndpointEnabled; + PublicNetworkAccess = publicNetworkAccess; CustomInit(); } @@ -116,6 +120,14 @@ public RegistryUpdateParameters() [JsonProperty(PropertyName = "properties.dataEndpointEnabled")] public bool? DataEndpointEnabled { get; set; } + /// + /// Gets or sets whether or not public network access is allowed for + /// the container registry. Possible values include: 'Enabled', + /// 'Disabled' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Replication.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Replication.cs index 09cca0fdaf990..6b4c57b49dbfc 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Replication.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/Replication.cs @@ -46,11 +46,17 @@ public Replication() /// 'Canceled' /// The status of the replication at the time the /// operation was called. - public Replication(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), Status status = default(Status)) + /// Specifies whether the + /// replication's regional endpoint is enabled. Requests will not be + /// routed to a replication whose regional endpoint is disabled, + /// however its data will continue to be synced with other + /// replications. + public Replication(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), Status status = default(Status), bool? regionEndpointEnabled = default(bool?)) : base(location, id, name, type, tags) { ProvisioningState = provisioningState; Status = status; + RegionEndpointEnabled = regionEndpointEnabled; CustomInit(); } @@ -74,6 +80,15 @@ public Replication() [JsonProperty(PropertyName = "properties.status")] public Status Status { get; private set; } + /// + /// Gets or sets specifies whether the replication's regional endpoint + /// is enabled. Requests will not be routed to a replication whose + /// regional endpoint is disabled, however its data will continue to be + /// synced with other replications. + /// + [JsonProperty(PropertyName = "properties.regionEndpointEnabled")] + public bool? RegionEndpointEnabled { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ReplicationUpdateParameters.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ReplicationUpdateParameters.cs index 33ae86bcc87d8..a8535ad1dedfa 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ReplicationUpdateParameters.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/ReplicationUpdateParameters.cs @@ -10,6 +10,8 @@ namespace Microsoft.Azure.Management.ContainerRegistry.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -18,6 +20,7 @@ namespace Microsoft.Azure.Management.ContainerRegistry.Models /// /// The parameters for updating a replication. /// + [Rest.Serialization.JsonTransformation] public partial class ReplicationUpdateParameters { /// @@ -34,9 +37,15 @@ public ReplicationUpdateParameters() /// class. /// /// The tags for the replication. - public ReplicationUpdateParameters(IDictionary tags = default(IDictionary)) + /// Specifies whether the + /// replication's regional endpoint is enabled. Requests will not be + /// routed to a replication whose regional endpoint is disabled, + /// however its data will continue to be synced with other + /// replications. + public ReplicationUpdateParameters(IDictionary tags = default(IDictionary), bool? regionEndpointEnabled = default(bool?)) { Tags = tags; + RegionEndpointEnabled = regionEndpointEnabled; CustomInit(); } @@ -51,5 +60,14 @@ public ReplicationUpdateParameters() [JsonProperty(PropertyName = "tags")] public IDictionary Tags { get; set; } + /// + /// Gets or sets specifies whether the replication's regional endpoint + /// is enabled. Requests will not be routed to a replication whose + /// regional endpoint is disabled, however its data will continue to be + /// synced with other replications. + /// + [JsonProperty(PropertyName = "properties.regionEndpointEnabled")] + public bool? RegionEndpointEnabled { get; set; } + } } diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/SourceTrigger.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/SourceTrigger.cs index f484086dd36e9..474f4051e7c9f 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/SourceTrigger.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/SourceTrigger.cs @@ -38,7 +38,7 @@ public SourceTrigger() /// the trigger. /// The name of the trigger. /// The current status of trigger. Possible values - /// include: 'Disabled', 'Enabled' + /// include: 'Enabled', 'Disabled' public SourceTrigger(SourceProperties sourceRepository, IList sourceTriggerEvents, string name, string status = default(string)) { SourceRepository = sourceRepository; @@ -68,7 +68,7 @@ public SourceTrigger() /// /// Gets or sets the current status of trigger. Possible values - /// include: 'Disabled', 'Enabled' + /// include: 'Enabled', 'Disabled' /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/SourceTriggerUpdateParameters.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/SourceTriggerUpdateParameters.cs index a393cb88ff6f0..2f337f0405501 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/SourceTriggerUpdateParameters.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/SourceTriggerUpdateParameters.cs @@ -40,7 +40,7 @@ public SourceTriggerUpdateParameters() /// The source event corresponding to /// the trigger. /// The current status of trigger. Possible values - /// include: 'Disabled', 'Enabled' + /// include: 'Enabled', 'Disabled' public SourceTriggerUpdateParameters(string name, SourceUpdateParameters sourceRepository = default(SourceUpdateParameters), IList sourceTriggerEvents = default(IList), string status = default(string)) { SourceRepository = sourceRepository; @@ -70,7 +70,7 @@ public SourceTriggerUpdateParameters() /// /// Gets or sets the current status of trigger. Possible values - /// include: 'Disabled', 'Enabled' + /// include: 'Enabled', 'Disabled' /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TimerTrigger.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TimerTrigger.cs index 5eccfcf912e44..67bb8fbe7d2e8 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TimerTrigger.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TimerTrigger.cs @@ -34,7 +34,7 @@ public TimerTrigger() /// schedule /// The name of the trigger. /// The current status of trigger. Possible values - /// include: 'Disabled', 'Enabled' + /// include: 'Enabled', 'Disabled' public TimerTrigger(string schedule, string name, string status = default(string)) { Schedule = schedule; @@ -56,7 +56,7 @@ public TimerTrigger() /// /// Gets or sets the current status of trigger. Possible values - /// include: 'Disabled', 'Enabled' + /// include: 'Enabled', 'Disabled' /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TimerTriggerUpdateParameters.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TimerTriggerUpdateParameters.cs index 9cbef21bd7b62..19d112045f769 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TimerTriggerUpdateParameters.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TimerTriggerUpdateParameters.cs @@ -36,7 +36,7 @@ public TimerTriggerUpdateParameters() /// The CRON expression for the task /// schedule /// The current status of trigger. Possible values - /// include: 'Disabled', 'Enabled' + /// include: 'Enabled', 'Disabled' public TimerTriggerUpdateParameters(string name, string schedule = default(string), string status = default(string)) { Schedule = schedule; @@ -58,7 +58,7 @@ public TimerTriggerUpdateParameters() /// /// Gets or sets the current status of trigger. Possible values - /// include: 'Disabled', 'Enabled' + /// include: 'Enabled', 'Disabled' /// [JsonProperty(PropertyName = "status")] public string Status { get; set; } diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TriggerStatus.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TriggerStatus.cs index 067d64b490055..171f02814b0dc 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TriggerStatus.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TriggerStatus.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Management.ContainerRegistry.Models /// public static class TriggerStatus { - public const string Disabled = "Disabled"; public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; } } diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/PipelineRunsOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/PipelineRunsOperations.cs new file mode 100644 index 0000000000000..7fb9b25bb4fbc --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/PipelineRunsOperations.cs @@ -0,0 +1,1238 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerRegistry +{ + 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; + + /// + /// PipelineRunsOperations operations. + /// + internal partial class PipelineRunsOperations : IServiceOperations, IPipelineRunsOperations + { + /// + /// Initializes a new instance of the PipelineRunsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PipelineRunsOperations(ContainerRegistryManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ContainerRegistryManagementClient + /// + public ContainerRegistryManagementClient Client { get; private set; } + + /// + /// Gets the detailed information for a given pipeline run. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string registryName, string pipelineRunName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (pipelineRunName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "pipelineRunName"); + } + if (pipelineRunName != null) + { + if (pipelineRunName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "pipelineRunName", 50); + } + if (pipelineRunName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "pipelineRunName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(pipelineRunName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "pipelineRunName", "^[a-zA-Z0-9]*$"); + } + } + string apiVersion = "2019-12-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + tracingParameters.Add("pipelineRunName", pipelineRunName); + 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.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{pipelineRunName}", System.Uri.EscapeDataString(pipelineRunName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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; + } + + /// + /// Creates a pipeline run for a container registry with the specified + /// parameters + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// The request parameters for a pipeline run. + /// + /// + /// How the pipeline run should be forced to recreate even if the pipeline run + /// configuration has not changed. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string pipelineRunName, PipelineRunRequest request = default(PipelineRunRequest), string forceUpdateTag = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, pipelineRunName, request, forceUpdateTag, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a pipeline run from a container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string pipelineRunName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, registryName, pipelineRunName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all the pipeline runs for the specified container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string registryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + string apiVersion = "2019-12-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + 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.ContainerRegistry/registries/{registryName}/pipelineRuns").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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; + } + + /// + /// Creates a pipeline run for a container registry with the specified + /// parameters + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// The request parameters for a pipeline run. + /// + /// + /// How the pipeline run should be forced to recreate even if the pipeline run + /// configuration has not changed. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string pipelineRunName, PipelineRunRequest request = default(PipelineRunRequest), string forceUpdateTag = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (pipelineRunName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "pipelineRunName"); + } + if (pipelineRunName != null) + { + if (pipelineRunName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "pipelineRunName", 50); + } + if (pipelineRunName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "pipelineRunName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(pipelineRunName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "pipelineRunName", "^[a-zA-Z0-9]*$"); + } + } + string apiVersion = "2019-12-01-preview"; + PipelineRun pipelineRunCreateParameters = new PipelineRun(); + if (request != null || forceUpdateTag != null) + { + pipelineRunCreateParameters.Request = request; + pipelineRunCreateParameters.ForceUpdateTag = forceUpdateTag; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + tracingParameters.Add("pipelineRunName", pipelineRunName); + tracingParameters.Add("pipelineRunCreateParameters", pipelineRunCreateParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{pipelineRunName}", System.Uri.EscapeDataString(pipelineRunName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(pipelineRunCreateParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(pipelineRunCreateParameters, 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 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); + } + } + // 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 pipeline run from a container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string pipelineRunName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (pipelineRunName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "pipelineRunName"); + } + if (pipelineRunName != null) + { + if (pipelineRunName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "pipelineRunName", 50); + } + if (pipelineRunName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "pipelineRunName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(pipelineRunName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "pipelineRunName", "^[a-zA-Z0-9]*$"); + } + } + string apiVersion = "2019-12-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + tracingParameters.Add("pipelineRunName", pipelineRunName); + 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.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{pipelineRunName}", System.Uri.EscapeDataString(pipelineRunName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the pipeline runs for the specified container registry. + /// + /// + /// 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 System.Threading.Tasks.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/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/PipelineRunsOperationsExtensions.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/PipelineRunsOperationsExtensions.cs new file mode 100644 index 0000000000000..09994f228e564 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/PipelineRunsOperationsExtensions.cs @@ -0,0 +1,354 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerRegistry +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + + /// + /// Extension methods for PipelineRunsOperations. + /// + public static partial class PipelineRunsOperationsExtensions + { + /// + /// Gets the detailed information for a given pipeline run. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + public static PipelineRun Get(this IPipelineRunsOperations operations, string resourceGroupName, string registryName, string pipelineRunName) + { + return operations.GetAsync(resourceGroupName, registryName, pipelineRunName).GetAwaiter().GetResult(); + } + + /// + /// Gets the detailed information for a given pipeline run. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IPipelineRunsOperations operations, string resourceGroupName, string registryName, string pipelineRunName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, registryName, pipelineRunName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a pipeline run for a container registry with the specified + /// parameters + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// The request parameters for a pipeline run. + /// + /// + /// How the pipeline run should be forced to recreate even if the pipeline run + /// configuration has not changed. + /// + public static PipelineRun Create(this IPipelineRunsOperations operations, string resourceGroupName, string registryName, string pipelineRunName, PipelineRunRequest request = default(PipelineRunRequest), string forceUpdateTag = default(string)) + { + return operations.CreateAsync(resourceGroupName, registryName, pipelineRunName, request, forceUpdateTag).GetAwaiter().GetResult(); + } + + /// + /// Creates a pipeline run for a container registry with the specified + /// parameters + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// The request parameters for a pipeline run. + /// + /// + /// How the pipeline run should be forced to recreate even if the pipeline run + /// configuration has not changed. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateAsync(this IPipelineRunsOperations operations, string resourceGroupName, string registryName, string pipelineRunName, PipelineRunRequest request = default(PipelineRunRequest), string forceUpdateTag = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, registryName, pipelineRunName, request, forceUpdateTag, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a pipeline run from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + public static void Delete(this IPipelineRunsOperations operations, string resourceGroupName, string registryName, string pipelineRunName) + { + operations.DeleteAsync(resourceGroupName, registryName, pipelineRunName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a pipeline run from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IPipelineRunsOperations operations, string resourceGroupName, string registryName, string pipelineRunName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, registryName, pipelineRunName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the pipeline runs for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + public static IPage List(this IPipelineRunsOperations operations, string resourceGroupName, string registryName) + { + return operations.ListAsync(resourceGroupName, registryName).GetAwaiter().GetResult(); + } + + /// + /// Lists all the pipeline runs for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IPipelineRunsOperations operations, string resourceGroupName, string registryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, registryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a pipeline run for a container registry with the specified + /// parameters + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// The request parameters for a pipeline run. + /// + /// + /// How the pipeline run should be forced to recreate even if the pipeline run + /// configuration has not changed. + /// + public static PipelineRun BeginCreate(this IPipelineRunsOperations operations, string resourceGroupName, string registryName, string pipelineRunName, PipelineRunRequest request = default(PipelineRunRequest), string forceUpdateTag = default(string)) + { + return operations.BeginCreateAsync(resourceGroupName, registryName, pipelineRunName, request, forceUpdateTag).GetAwaiter().GetResult(); + } + + /// + /// Creates a pipeline run for a container registry with the specified + /// parameters + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// The request parameters for a pipeline run. + /// + /// + /// How the pipeline run should be forced to recreate even if the pipeline run + /// configuration has not changed. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateAsync(this IPipelineRunsOperations operations, string resourceGroupName, string registryName, string pipelineRunName, PipelineRunRequest request = default(PipelineRunRequest), string forceUpdateTag = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, pipelineRunName, request, forceUpdateTag, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a pipeline run from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + public static void BeginDelete(this IPipelineRunsOperations operations, string resourceGroupName, string registryName, string pipelineRunName) + { + operations.BeginDeleteAsync(resourceGroupName, registryName, pipelineRunName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a pipeline run from a container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of the pipeline run. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IPipelineRunsOperations operations, string resourceGroupName, string registryName, string pipelineRunName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, registryName, pipelineRunName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all the pipeline runs for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IPipelineRunsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the pipeline runs for the specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IPipelineRunsOperations 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/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ReplicationsOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ReplicationsOperations.cs index 28d63565dd059..58d4b305a18dc 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ReplicationsOperations.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ReplicationsOperations.cs @@ -302,12 +302,8 @@ internal ReplicationsOperations(ContainerRegistryManagementClient client) /// /// The name of the replication. /// - /// - /// The location of the resource. This cannot be changed after the resource is - /// created. - /// - /// - /// The tags of the resource. + /// + /// The parameters for creating a replication. /// /// /// The headers that will be added to request. @@ -315,10 +311,10 @@ internal ReplicationsOperations(ContainerRegistryManagementClient client) /// /// The cancellation token. /// - public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, string location, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, Replication replication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, replicationName, location, tags, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, replicationName, replication, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -363,16 +359,21 @@ internal ReplicationsOperations(ContainerRegistryManagementClient client) /// /// The tags for the replication. /// + /// + /// Specifies whether the replication's regional endpoint is enabled. Requests + /// will not be routed to a replication whose regional endpoint is disabled, + /// however its data will continue to be synced with other replications. + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary), bool? regionEndpointEnabled = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, registryName, replicationName, tags, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, registryName, replicationName, tags, regionEndpointEnabled, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -605,12 +606,8 @@ internal ReplicationsOperations(ContainerRegistryManagementClient client) /// /// The name of the replication. /// - /// - /// The location of the resource. This cannot be changed after the resource is - /// created. - /// - /// - /// The tags of the resource. + /// + /// The parameters for creating a replication. /// /// /// Headers that will be added to request. @@ -633,7 +630,7 @@ internal ReplicationsOperations(ContainerRegistryManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, string location, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, Replication replication, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -688,17 +685,15 @@ internal ReplicationsOperations(ContainerRegistryManagementClient client) throw new ValidationException(ValidationRules.Pattern, "replicationName", "^[a-zA-Z0-9]*$"); } } - if (location == null) + if (replication == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "location"); + throw new ValidationException(ValidationRules.CannotBeNull, "replication"); } - string apiVersion = "2019-12-01-preview"; - Replication replication = new Replication(); - if (location != null || tags != null) + if (replication != null) { - replication.Location = location; - replication.Tags = tags; + replication.Validate(); } + string apiVersion = "2019-12-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1110,6 +1105,11 @@ internal ReplicationsOperations(ContainerRegistryManagementClient client) /// /// The tags for the replication. /// + /// + /// Specifies whether the replication's regional endpoint is enabled. Requests + /// will not be routed to a replication whose regional endpoint is disabled, + /// however its data will continue to be synced with other replications. + /// /// /// Headers that will be added to request. /// @@ -1131,7 +1131,7 @@ internal ReplicationsOperations(ContainerRegistryManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary), bool? regionEndpointEnabled = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -1188,9 +1188,10 @@ internal ReplicationsOperations(ContainerRegistryManagementClient client) } string apiVersion = "2019-12-01-preview"; ReplicationUpdateParameters replicationUpdateParameters = new ReplicationUpdateParameters(); - if (tags != null) + if (tags != null || regionEndpointEnabled != null) { replicationUpdateParameters.Tags = tags; + replicationUpdateParameters.RegionEndpointEnabled = regionEndpointEnabled; } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ReplicationsOperationsExtensions.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ReplicationsOperationsExtensions.cs index e9ed7eac22d94..407ec2da3fc25 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ReplicationsOperationsExtensions.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ReplicationsOperationsExtensions.cs @@ -84,16 +84,12 @@ public static Replication Get(this IReplicationsOperations operations, string re /// /// The name of the replication. /// - /// - /// The location of the resource. This cannot be changed after the resource is - /// created. + /// + /// The parameters for creating a replication. /// - /// - /// The tags of the resource. - /// - public static Replication Create(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, string location, IDictionary tags = default(IDictionary)) + public static Replication Create(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, Replication replication) { - return operations.CreateAsync(resourceGroupName, registryName, replicationName, location, tags).GetAwaiter().GetResult(); + return operations.CreateAsync(resourceGroupName, registryName, replicationName, replication).GetAwaiter().GetResult(); } /// @@ -112,19 +108,15 @@ public static Replication Get(this IReplicationsOperations operations, string re /// /// The name of the replication. /// - /// - /// The location of the resource. This cannot be changed after the resource is - /// created. - /// - /// - /// The tags of the resource. + /// + /// The parameters for creating a replication. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateAsync(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, string location, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + public static async System.Threading.Tasks.Task CreateAsync(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, Replication replication, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, registryName, replicationName, location, tags, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, registryName, replicationName, replication, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -192,9 +184,14 @@ public static void Delete(this IReplicationsOperations operations, string resour /// /// The tags for the replication. /// - public static Replication Update(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary)) + /// + /// Specifies whether the replication's regional endpoint is enabled. Requests + /// will not be routed to a replication whose regional endpoint is disabled, + /// however its data will continue to be synced with other replications. + /// + public static Replication Update(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary), bool? regionEndpointEnabled = default(bool?)) { - return operations.UpdateAsync(resourceGroupName, registryName, replicationName, tags).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, registryName, replicationName, tags, regionEndpointEnabled).GetAwaiter().GetResult(); } /// @@ -216,12 +213,17 @@ public static void Delete(this IReplicationsOperations operations, string resour /// /// The tags for the replication. /// + /// + /// Specifies whether the replication's regional endpoint is enabled. Requests + /// will not be routed to a replication whose regional endpoint is disabled, + /// however its data will continue to be synced with other replications. + /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task UpdateAsync(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + public static async System.Threading.Tasks.Task UpdateAsync(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary), bool? regionEndpointEnabled = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, registryName, replicationName, tags, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, registryName, replicationName, tags, regionEndpointEnabled, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -283,16 +285,12 @@ public static IPage List(this IReplicationsOperations operations, s /// /// The name of the replication. /// - /// - /// The location of the resource. This cannot be changed after the resource is - /// created. + /// + /// The parameters for creating a replication. /// - /// - /// The tags of the resource. - /// - public static Replication BeginCreate(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, string location, IDictionary tags = default(IDictionary)) + public static Replication BeginCreate(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, Replication replication) { - return operations.BeginCreateAsync(resourceGroupName, registryName, replicationName, location, tags).GetAwaiter().GetResult(); + return operations.BeginCreateAsync(resourceGroupName, registryName, replicationName, replication).GetAwaiter().GetResult(); } /// @@ -311,19 +309,15 @@ public static IPage List(this IReplicationsOperations operations, s /// /// The name of the replication. /// - /// - /// The location of the resource. This cannot be changed after the resource is - /// created. - /// - /// - /// The tags of the resource. + /// + /// The parameters for creating a replication. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginCreateAsync(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, string location, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + public static async System.Threading.Tasks.Task BeginCreateAsync(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, Replication replication, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, replicationName, location, tags, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, replicationName, replication, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -391,9 +385,14 @@ public static void BeginDelete(this IReplicationsOperations operations, string r /// /// The tags for the replication. /// - public static Replication BeginUpdate(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary)) + /// + /// Specifies whether the replication's regional endpoint is enabled. Requests + /// will not be routed to a replication whose regional endpoint is disabled, + /// however its data will continue to be synced with other replications. + /// + public static Replication BeginUpdate(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary), bool? regionEndpointEnabled = default(bool?)) { - return operations.BeginUpdateAsync(resourceGroupName, registryName, replicationName, tags).GetAwaiter().GetResult(); + return operations.BeginUpdateAsync(resourceGroupName, registryName, replicationName, tags, regionEndpointEnabled).GetAwaiter().GetResult(); } /// @@ -415,12 +414,17 @@ public static void BeginDelete(this IReplicationsOperations operations, string r /// /// The tags for the replication. /// + /// + /// Specifies whether the replication's regional endpoint is enabled. Requests + /// will not be routed to a replication whose regional endpoint is disabled, + /// however its data will continue to be synced with other replications. + /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginUpdateAsync(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + public static async System.Threading.Tasks.Task BeginUpdateAsync(this IReplicationsOperations operations, string resourceGroupName, string registryName, string replicationName, IDictionary tags = default(IDictionary), bool? regionEndpointEnabled = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, registryName, replicationName, tags, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, registryName, replicationName, tags, regionEndpointEnabled, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/SdkInfo_ContainerRegistryManagementClient.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/SdkInfo_ContainerRegistryManagementClient.cs index 1123459a2cbdc..b3e732b41408b 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/SdkInfo_ContainerRegistryManagementClient.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/SdkInfo_ContainerRegistryManagementClient.cs @@ -20,7 +20,10 @@ public static IEnumerable> ApiInfo_ContainerRegist return new Tuple[] { new Tuple("ContainerRegistry", "AgentPools", "2019-06-01-preview"), + new Tuple("ContainerRegistry", "ExportPipelines", "2019-12-01-preview"), + new Tuple("ContainerRegistry", "ImportPipelines", "2019-12-01-preview"), new Tuple("ContainerRegistry", "Operations", "2019-12-01-preview"), + new Tuple("ContainerRegistry", "PipelineRuns", "2019-12-01-preview"), new Tuple("ContainerRegistry", "PrivateEndpointConnections", "2019-12-01-preview"), new Tuple("ContainerRegistry", "Registries", "2019-05-01-preview"), new Tuple("ContainerRegistry", "Registries", "2019-06-01-preview"), @@ -35,16 +38,5 @@ public static IEnumerable> ApiInfo_ContainerRegist }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/containerregistry/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\src\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "b31774e70476dd2c2ce075204832eccffda36109"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -