Beispiel #1
0
 private Amazon.ECR.Model.UploadLayerPartResponse CallAWSServiceOperation(IAmazonECR client, Amazon.ECR.Model.UploadLayerPartRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon EC2 Container Registry", "UploadLayerPart");
     try
     {
         #if DESKTOP
         return(client.UploadLayerPart(request));
         #elif CORECLR
         return(client.UploadLayerPartAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
Beispiel #2
0
 internal ListImagesPaginator(IAmazonECR client, ListImagesRequest request)
 {
     this._client  = client;
     this._request = request;
 }
Beispiel #3
0
 internal DescribeRepositoriesPaginator(IAmazonECR client, DescribeRepositoriesRequest request)
 {
     this._client  = client;
     this._request = request;
 }
Beispiel #4
0
 internal DescribePullThroughCacheRulesPaginator(IAmazonECR client, DescribePullThroughCacheRulesRequest request)
 {
     this._client  = client;
     this._request = request;
 }
 public ImagesService(IAmazonECR containerRegistryClient)
 {
     _containerRegistryClient = containerRegistryClient;
 }
Beispiel #6
0
 internal GetLifecyclePolicyPreviewPaginator(IAmazonECR client, GetLifecyclePolicyPreviewRequest request)
 {
     this._client  = client;
     this._request = request;
 }
 internal ECRPaginatorFactory(IAmazonECR client)
 {
     this.client = client;
 }
Beispiel #8
0
 internal DescribeImageScanFindingsPaginator(IAmazonECR client, DescribeImageScanFindingsRequest request)
 {
     this._client  = client;
     this._request = request;
 }
        public static async Task <string> ExpandImageTagIfNecessary(IToolLogger logger, IAmazonECR ecrClient, string dockerImageTag)
        {
            try
            {
                if (dockerImageTag.Contains(".amazonaws."))
                {
                    return(dockerImageTag);
                }

                string repositoryName = dockerImageTag;
                if (repositoryName.Contains(":"))
                {
                    repositoryName = repositoryName.Substring(0, repositoryName.IndexOf(':'));
                }

                DescribeRepositoriesResponse describeResponse = null;
                try
                {
                    describeResponse = await ecrClient.DescribeRepositoriesAsync(new DescribeRepositoriesRequest
                    {
                        RepositoryNames = new List <string> {
                            repositoryName
                        }
                    });
                }
                catch (Exception e)
                {
                    if (!(e is RepositoryNotFoundException))
                    {
                        throw;
                    }
                }

                // Not found in ECR, assume pulling Docker Hub
                if (describeResponse == null)
                {
                    return(dockerImageTag);
                }

                var fullPath = describeResponse.Repositories[0].RepositoryUri + dockerImageTag.Substring(dockerImageTag.IndexOf(':'));
                logger?.WriteLine($"Determined full image name to be {fullPath}");
                return(fullPath);
            }
            catch (DockerToolsException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new DockerToolsException($"Error determining full repository path for the image {dockerImageTag}: {e.Message}", DockerToolsException.ECSErrorCode.FailedToExpandImageTag);
            }
        }
Beispiel #10
0
 public GetRepositoryByNameQueryHandler(
     IAmazonECR amazonEcr)
 {
     this.amazonEcr = amazonEcr;
 }
Beispiel #11
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            Client = CreateClient(_CurrentCredentials, _RegionEndpoint);
        }