Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>

namespace Microsoft.Azure.ContainerRegistry
{
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
using System.Threading;
using System.Threading.Tasks;

/// <summary>
/// Extension methods for AccessTokensOperations.
/// </summary>
public static partial class AccessTokensOperationsExtensions
{
/// <summary>
/// Exchange ACR Refresh token for an ACR Access Token
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='service'>
/// Indicates the name of your Azure container registry.
/// </param>
/// <param name='scope'>
/// Which is expected to be a valid scope, and can be specified more than once
/// for multiple scope requests. You obtained this from the Www-Authenticate
/// response header from the challenge.
/// </param>
/// <param name='refreshToken'>
/// Must be a valid ACR refresh token
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<AccessToken> GetAsync(this IAccessTokensOperations operations, string service, string scope, string refreshToken, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetWithHttpMessagesAsync(service, scope, refreshToken, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}

/// <summary>
/// Exchange Username, Password and Scope an ACR Access Token
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='service'>
/// Indicates the name of your Azure container registry.
/// </param>
/// <param name='scope'>
/// Expected to be a valid scope, and can be specified more than once for
/// multiple scope requests. You can obtain this from the Www-Authenticate
/// response header from the challenge.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<AccessToken> GetFromLoginAsync(this IAccessTokensOperations operations, string service, string scope, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetFromLoginWithHttpMessagesAsync(service, scope, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>

namespace Microsoft.Azure.ContainerRegistry
{
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Microsoft.Rest.Serialization;
using Models;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;

/// <summary>
/// Metadata API definition for the Azure Container Registry runtime
/// </summary>
public partial class AzureContainerRegistryClient : ServiceClient<AzureContainerRegistryClient>, IAzureContainerRegistryClient, IAzureClient
{
/// <summary>
/// The base URI of the service.
/// </summary>
internal string BaseUri {get; set;}

/// <summary>
/// Gets or sets json serialization settings.
/// </summary>
public JsonSerializerSettings SerializationSettings { get; private set; }

/// <summary>
/// Gets or sets json deserialization settings.
/// </summary>
public JsonSerializerSettings DeserializationSettings { get; private set; }

/// <summary>
/// Credentials needed for the client to connect to Azure.
/// </summary>
public ServiceClientCredentials Credentials { get; private set; }

/// <summary>
/// Registry login URL
/// </summary>
public string LoginUri { get; set; }

/// <summary>
/// The preferred language for the response.
/// </summary>
public string AcceptLanguage { get; set; }

/// <summary>
/// The retry timeout in seconds for Long Running Operations. Default value is
/// 30.
/// </summary>
public int? LongRunningOperationRetryTimeout { get; set; }

/// <summary>
/// Whether a unique x-ms-client-request-id should be generated. When set to
/// true a unique x-ms-client-request-id value is generated and included in
/// each request. Default is true.
/// </summary>
public bool? GenerateClientRequestId { get; set; }

/// <summary>
/// Gets the IV2SupportOperations.
/// </summary>
public virtual IV2SupportOperations V2Support { get; private set; }

/// <summary>
/// Gets the IManifestsOperations.
/// </summary>
public virtual IManifestsOperations Manifests { get; private set; }

/// <summary>
/// Gets the IBlobOperations.
/// </summary>
public virtual IBlobOperations Blob { get; private set; }

/// <summary>
/// Gets the IRepositoryOperations.
/// </summary>
public virtual IRepositoryOperations Repository { get; private set; }

/// <summary>
/// Gets the ITagOperations.
/// </summary>
public virtual ITagOperations Tag { get; private set; }

/// <summary>
/// Gets the IRefreshTokensOperations.
/// </summary>
public virtual IRefreshTokensOperations RefreshTokens { get; private set; }

/// <summary>
/// Gets the IAccessTokensOperations.
/// </summary>
public virtual IAccessTokensOperations AccessTokens { get; private set; }

/// <summary>
/// Initializes a new instance of the AzureContainerRegistryClient class.
/// </summary>
/// <param name='httpClient'>
/// HttpClient to be used
/// </param>
/// <param name='disposeHttpClient'>
/// True: will dispose the provided httpClient on calling AzureContainerRegistryClient.Dispose(). False: will not dispose provided httpClient</param>
protected AzureContainerRegistryClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient)
{
Initialize();
}

/// <summary>
/// Initializes a new instance of the AzureContainerRegistryClient class.
/// </summary>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
protected AzureContainerRegistryClient(params DelegatingHandler[] handlers) : base(handlers)
{
Initialize();
}

/// <summary>
/// Initializes a new instance of the AzureContainerRegistryClient class.
/// </summary>
/// <param name='rootHandler'>
/// Optional. The http client handler used to handle http transport.
/// </param>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
protected AzureContainerRegistryClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers)
{
Initialize();
}

/// <summary>
/// Initializes a new instance of the AzureContainerRegistryClient class.
/// </summary>
/// <param name='credentials'>
/// Required. Credentials needed for the client to connect to Azure.
/// </param>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
public AzureContainerRegistryClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
{
if (credentials == null)
{
throw new System.ArgumentNullException("credentials");
}
Credentials = credentials;
if (Credentials != null)
{
Credentials.InitializeServiceClient(this);
}
}

/// <summary>
/// Initializes a new instance of the AzureContainerRegistryClient class.
/// </summary>
/// <param name='credentials'>
/// Required. Credentials needed for the client to connect to Azure.
/// </param>
/// <param name='httpClient'>
/// HttpClient to be used
/// </param>
/// <param name='disposeHttpClient'>
/// True: will dispose the provided httpClient on calling AzureContainerRegistryClient.Dispose(). False: will not dispose provided httpClient</param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
public AzureContainerRegistryClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient)
{
if (credentials == null)
{
throw new System.ArgumentNullException("credentials");
}
Credentials = credentials;
if (Credentials != null)
{
Credentials.InitializeServiceClient(this);
}
}

/// <summary>
/// Initializes a new instance of the AzureContainerRegistryClient class.
/// </summary>
/// <param name='credentials'>
/// Required. Credentials needed for the client to connect to Azure.
/// </param>
/// <param name='rootHandler'>
/// Optional. The http client handler used to handle http transport.
/// </param>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
public AzureContainerRegistryClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
{
if (credentials == null)
{
throw new System.ArgumentNullException("credentials");
}
Credentials = credentials;
if (Credentials != null)
{
Credentials.InitializeServiceClient(this);
}
}

/// <summary>
/// An optional partial-method to perform custom initialization.
/// </summary>
partial void CustomInitialize();
/// <summary>
/// Initializes client properties.
/// </summary>
private void Initialize()
{
V2Support = new V2SupportOperations(this);
Manifests = new ManifestsOperations(this);
Blob = new BlobOperations(this);
Repository = new RepositoryOperations(this);
Tag = new TagOperations(this);
RefreshTokens = new RefreshTokensOperations(this);
AccessTokens = new AccessTokensOperations(this);
BaseUri = "{url}";
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
SerializationSettings = new JsonSerializerSettings
{
Formatting = Newtonsoft.Json.Formatting.Indented,
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
Converters = new List<JsonConverter>
{
new Iso8601TimeSpanConverter()
}
};
DeserializationSettings = new JsonSerializerSettings
{
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
Converters = new List<JsonConverter>
{
new Iso8601TimeSpanConverter()
}
};
CustomInitialize();
DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
}
}
}
Loading