< Summary

Class:Microsoft.Azure.ContainerRegistry.AzureContainerRegistryClient
Assembly:Microsoft.Azure.ContainerRegistry
File(s):C:\Git\azure-sdk-for-net\sdk\containerregistry\Microsoft.Azure.ContainerRegistry\src\Customizations\AzureContainerRegistryClientExtended.cs
C:\Git\azure-sdk-for-net\sdk\containerregistry\Microsoft.Azure.ContainerRegistry\src\Generated\AzureContainerRegistryClient.cs
Covered lines:61
Uncovered lines:41
Coverable lines:102
Total lines:359
Line coverage:59.8% (61 of 102)
Covered branches:4
Total branches:24
Branch coverage:16.6% (4 of 24)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-87.5%66.67%
.ctor(...)-0%0%
get_BaseUri()-100%100%
get_SerializationSettings()-100%100%
get_DeserializationSettings()-100%100%
get_Credentials()-100%100%
get_LoginUri()-100%100%
get_AcceptLanguage()-100%100%
get_LongRunningOperationRetryTimeout()-0%100%
get_GenerateClientRequestId()-100%100%
get_V2Support()-0%100%
get_Manifests()-100%100%
get_Blob()-100%100%
get_Repository()-100%100%
get_Tag()-100%100%
get_RefreshTokens()-100%100%
get_AccessTokens()-100%100%
.ctor(...)-0%100%
.ctor(...)-100%100%
.ctor(...)-0%100%
.ctor(...)-0%0%
.ctor(...)-0%0%
.ctor(...)-0%0%
Initialize()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\containerregistry\Microsoft.Azure.ContainerRegistry\src\Customizations\AzureContainerRegistryClientExtended.cs

#LineLine coverage
 1using Microsoft.Rest;
 2using Microsoft.Rest.Azure;
 3using System.Net.Http;
 4namespace Microsoft.Azure.ContainerRegistry
 5{
 6    public partial class AzureContainerRegistryClient : ServiceClient<AzureContainerRegistryClient>, IAzureContainerRegi
 7    {
 8
 9        // MANUALLY ADDED FOR INTERNAL TEST PURPOSES / FOR TESTING FRAMEWORK USE ONLY
 10        /// <summary>
 11        /// Initializes a new instance of the AzureContainerRegistryClient class.
 12        /// </summary>
 13        /// <param name='baseUri'>
 14        /// Optional. The base URI of the service.
 15        /// </param>
 16        /// <param name='credentials'>
 17        /// Required. Credentials needed for the client to connect to Azure.
 18        /// </param>
 19        /// <param name='handlers'>
 20        /// Optional. The delegating handlers to add to the http client pipeline.
 21        /// </param>
 22        /// <exception cref="System.ArgumentNullException">
 23        /// Thrown when a required parameter is null
 24        /// </exception>
 25
 6026        internal AzureContainerRegistryClient(System.Uri loginUri, ServiceClientCredentials credentials, params Delegati
 27        {
 6028            if (loginUri == null)
 29            {
 030                throw new System.ArgumentNullException(nameof(loginUri));
 31            }
 32
 6033            BaseUri = "{url}";
 6034            Credentials = credentials ?? throw new System.ArgumentNullException(nameof(credentials));
 6035            if (Credentials != null)
 36
 37            {
 6038                Credentials.InitializeServiceClient(this);
 39            }
 40
 6041        }
 42
 43        /// <summary>
 44        /// Initializes a new instance of the AzureContainerRegistryClient class. Allows users to specify a loginUrl
 45        /// </summary>
 46        /// <param name='loginUrl'>
 47        /// Required The base URl of the Azure Container Registry Service
 48        /// </param>
 49        /// <param name='credentials'>
 50        /// Required. Credentials needed for the client to connect to Azure.
 51        /// </param>
 52        /// <param name='handlers'>
 53        /// Optional. The delegating handlers to add to the http client pipeline.
 54        /// </param>
 55        /// <exception cref="System.ArgumentNullException">
 56        /// Thrown when a required parameter is null
 57        /// </exception>
 058        public AzureContainerRegistryClient(string loginUrl, ServiceClientCredentials credentials, params DelegatingHand
 59        {
 060            if (credentials == null)
 61            {
 062                throw new System.ArgumentNullException("credentials");
 63            }
 64
 65            // prevents issues if caller sets an incorrect '/' at the end
 066            if (loginUrl.EndsWith("/")) {
 067                loginUrl = loginUrl.Substring(0, loginUrl.Length - 1);
 68            }
 69
 70            // prevents issues if caller does not prefix url with "http"
 071            if (!loginUrl.ToLower().StartsWith("http"))
 72            {
 073                loginUrl = $"https://{loginUrl}";
 74            }
 75
 76            // set fields / properties
 077            LoginUri = loginUrl;
 078            Credentials = credentials;
 079            Credentials.InitializeServiceClient(this);
 080        }
 81    }
 82
 83}
 84
 85

C:\Git\azure-sdk-for-net\sdk\containerregistry\Microsoft.Azure.ContainerRegistry\src\Generated\AzureContainerRegistryClient.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.ContainerRegistry
 12{
 13    using Microsoft.Rest;
 14    using Microsoft.Rest.Azure;
 15    using Microsoft.Rest.Serialization;
 16    using Models;
 17    using Newtonsoft.Json;
 18    using System.Collections;
 19    using System.Collections.Generic;
 20    using System.Linq;
 21    using System.Net;
 22    using System.Net.Http;
 23
 24    /// <summary>
 25    /// Metadata API definition for the Azure Container Registry runtime
 26    /// </summary>
 27    public partial class AzureContainerRegistryClient : ServiceClient<AzureContainerRegistryClient>, IAzureContainerRegi
 28    {
 29        /// <summary>
 30        /// The base URI of the service.
 31        /// </summary>
 23432        internal string BaseUri {get; set;}
 33
 34        /// <summary>
 35        /// Gets or sets json serialization settings.
 36        /// </summary>
 7637        public JsonSerializerSettings SerializationSettings { get; private set; }
 38
 39        /// <summary>
 40        /// Gets or sets json deserialization settings.
 41        /// </summary>
 22242        public JsonSerializerSettings DeserializationSettings { get; private set; }
 43
 44        /// <summary>
 45        /// Credentials needed for the client to connect to Azure.
 46        /// </summary>
 40847        public ServiceClientCredentials Credentials { get; private set; }
 48
 49        /// <summary>
 50        /// Registry login URL
 51        /// </summary>
 34852        public string LoginUri { get; set; }
 53
 54        /// <summary>
 55        /// The preferred language for the response.
 56        /// </summary>
 28857        public string AcceptLanguage { get; set; }
 58
 59        /// <summary>
 60        /// The retry timeout in seconds for Long Running Operations. Default value is
 61        /// 30.
 62        /// </summary>
 063        public int? LongRunningOperationRetryTimeout { get; set; }
 64
 65        /// <summary>
 66        /// Whether a unique x-ms-client-request-id should be generated. When set to
 67        /// true a unique x-ms-client-request-id value is generated and included in
 68        /// each request. Default is true.
 69        /// </summary>
 28870        public bool? GenerateClientRequestId { get; set; }
 71
 72        /// <summary>
 73        /// Gets the IV2SupportOperations.
 74        /// </summary>
 075        public virtual IV2SupportOperations V2Support { get; private set; }
 76
 77        /// <summary>
 78        /// Gets the IManifestsOperations.
 79        /// </summary>
 8880        public virtual IManifestsOperations Manifests { get; private set; }
 81
 82        /// <summary>
 83        /// Gets the IBlobOperations.
 84        /// </summary>
 10085        public virtual IBlobOperations Blob { get; private set; }
 86
 87        /// <summary>
 88        /// Gets the IRepositoryOperations.
 89        /// </summary>
 7690        public virtual IRepositoryOperations Repository { get; private set; }
 91
 92        /// <summary>
 93        /// Gets the ITagOperations.
 94        /// </summary>
 8295        public virtual ITagOperations Tag { get; private set; }
 96
 97        /// <summary>
 98        /// Gets the IRefreshTokensOperations.
 99        /// </summary>
 64100        public virtual IRefreshTokensOperations RefreshTokens { get; private set; }
 101
 102        /// <summary>
 103        /// Gets the IAccessTokensOperations.
 104        /// </summary>
 64105        public virtual IAccessTokensOperations AccessTokens { get; private set; }
 106
 107        /// <summary>
 108        /// Initializes a new instance of the AzureContainerRegistryClient class.
 109        /// </summary>
 110        /// <param name='httpClient'>
 111        /// HttpClient to be used
 112        /// </param>
 113        /// <param name='disposeHttpClient'>
 114        /// True: will dispose the provided httpClient on calling AzureContainerRegistryClient.Dispose(). False: will no
 0115        protected AzureContainerRegistryClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, dispose
 116        {
 0117            Initialize();
 0118        }
 119
 120        /// <summary>
 121        /// Initializes a new instance of the AzureContainerRegistryClient class.
 122        /// </summary>
 123        /// <param name='handlers'>
 124        /// Optional. The delegating handlers to add to the http client pipeline.
 125        /// </param>
 60126        protected AzureContainerRegistryClient(params DelegatingHandler[] handlers) : base(handlers)
 127        {
 60128            Initialize();
 60129        }
 130
 131        /// <summary>
 132        /// Initializes a new instance of the AzureContainerRegistryClient class.
 133        /// </summary>
 134        /// <param name='rootHandler'>
 135        /// Optional. The http client handler used to handle http transport.
 136        /// </param>
 137        /// <param name='handlers'>
 138        /// Optional. The delegating handlers to add to the http client pipeline.
 139        /// </param>
 0140        protected AzureContainerRegistryClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : bas
 141        {
 0142            Initialize();
 0143        }
 144
 145        /// <summary>
 146        /// Initializes a new instance of the AzureContainerRegistryClient class.
 147        /// </summary>
 148        /// <param name='credentials'>
 149        /// Required. Credentials needed for the client to connect to Azure.
 150        /// </param>
 151        /// <param name='handlers'>
 152        /// Optional. The delegating handlers to add to the http client pipeline.
 153        /// </param>
 154        /// <exception cref="System.ArgumentNullException">
 155        /// Thrown when a required parameter is null
 156        /// </exception>
 0157        public AzureContainerRegistryClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) :
 158        {
 0159            if (credentials == null)
 160            {
 0161                throw new System.ArgumentNullException("credentials");
 162            }
 0163            Credentials = credentials;
 0164            if (Credentials != null)
 165            {
 0166                Credentials.InitializeServiceClient(this);
 167            }
 0168        }
 169
 170        /// <summary>
 171        /// Initializes a new instance of the AzureContainerRegistryClient class.
 172        /// </summary>
 173        /// <param name='credentials'>
 174        /// Required. Credentials needed for the client to connect to Azure.
 175        /// </param>
 176        /// <param name='httpClient'>
 177        /// HttpClient to be used
 178        /// </param>
 179        /// <param name='disposeHttpClient'>
 180        /// True: will dispose the provided httpClient on calling AzureContainerRegistryClient.Dispose(). False: will no
 181        /// <exception cref="System.ArgumentNullException">
 182        /// Thrown when a required parameter is null
 183        /// </exception>
 0184        public AzureContainerRegistryClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHtt
 185        {
 0186            if (credentials == null)
 187            {
 0188                throw new System.ArgumentNullException("credentials");
 189            }
 0190            Credentials = credentials;
 0191            if (Credentials != null)
 192            {
 0193                Credentials.InitializeServiceClient(this);
 194            }
 0195        }
 196
 197        /// <summary>
 198        /// Initializes a new instance of the AzureContainerRegistryClient class.
 199        /// </summary>
 200        /// <param name='credentials'>
 201        /// Required. Credentials needed for the client to connect to Azure.
 202        /// </param>
 203        /// <param name='rootHandler'>
 204        /// Optional. The http client handler used to handle http transport.
 205        /// </param>
 206        /// <param name='handlers'>
 207        /// Optional. The delegating handlers to add to the http client pipeline.
 208        /// </param>
 209        /// <exception cref="System.ArgumentNullException">
 210        /// Thrown when a required parameter is null
 211        /// </exception>
 0212        public AzureContainerRegistryClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params 
 213        {
 0214            if (credentials == null)
 215            {
 0216                throw new System.ArgumentNullException("credentials");
 217            }
 0218            Credentials = credentials;
 0219            if (Credentials != null)
 220            {
 0221                Credentials.InitializeServiceClient(this);
 222            }
 0223        }
 224
 225        /// <summary>
 226        /// An optional partial-method to perform custom initialization.
 227        /// </summary>
 228        partial void CustomInitialize();
 229        /// <summary>
 230        /// Initializes client properties.
 231        /// </summary>
 232        private void Initialize()
 233        {
 60234            V2Support = new V2SupportOperations(this);
 60235            Manifests = new ManifestsOperations(this);
 60236            Blob = new BlobOperations(this);
 60237            Repository = new RepositoryOperations(this);
 60238            Tag = new TagOperations(this);
 60239            RefreshTokens = new RefreshTokensOperations(this);
 60240            AccessTokens = new AccessTokensOperations(this);
 60241            BaseUri = "{url}";
 60242            AcceptLanguage = "en-US";
 60243            LongRunningOperationRetryTimeout = 30;
 60244            GenerateClientRequestId = true;
 60245            SerializationSettings = new JsonSerializerSettings
 60246            {
 60247                Formatting = Newtonsoft.Json.Formatting.Indented,
 60248                DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
 60249                DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
 60250                NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
 60251                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
 60252                ContractResolver = new ReadOnlyJsonContractResolver(),
 60253                Converters = new List<JsonConverter>
 60254                    {
 60255                        new Iso8601TimeSpanConverter()
 60256                    }
 60257            };
 60258            DeserializationSettings = new JsonSerializerSettings
 60259            {
 60260                DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
 60261                DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
 60262                NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
 60263                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
 60264                ContractResolver = new ReadOnlyJsonContractResolver(),
 60265                Converters = new List<JsonConverter>
 60266                    {
 60267                        new Iso8601TimeSpanConverter()
 60268                    }
 60269            };
 270            CustomInitialize();
 60271            DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
 60272        }
 273    }
 274}