public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ECR.Model.CompleteLayerUploadRequest(); if (cmdletContext.LayerDigest != null) { request.LayerDigests = cmdletContext.LayerDigest; } if (cmdletContext.RegistryId != null) { request.RegistryId = cmdletContext.RegistryId; } if (cmdletContext.RepositoryName != null) { request.RepositoryName = cmdletContext.RepositoryName; } if (cmdletContext.UploadId != null) { request.UploadId = cmdletContext.UploadId; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
private Amazon.ECR.Model.CompleteLayerUploadResponse CallAWSServiceOperation(IAmazonECR client, Amazon.ECR.Model.CompleteLayerUploadRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon EC2 Container Registry", "CompleteLayerUpload"); try { #if DESKTOP return(client.CompleteLayerUpload(request)); #elif CORECLR return(client.CompleteLayerUploadAsync(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; } }
/// <summary> /// Inform Amazon ECR that the image layer upload for a specified registry, repository /// name, and upload ID, has completed. You can optionally provide a <code>sha256</code> /// digest of the image layer for data validation purposes. /// /// <note> /// <para> /// This operation is used by the Amazon ECR proxy, and it is not intended for general /// use by customers for pulling and pushing images. In most cases, you should use the /// <code>docker</code> CLI to pull, tag, and push images. /// </para> /// </note> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CompleteLayerUpload service method.</param> /// /// <returns>The response from the CompleteLayerUpload service method, as returned by ECR.</returns> /// <exception cref="Amazon.ECR.Model.EmptyUploadException"> /// The specified layer upload does not contain any layer parts. /// </exception> /// <exception cref="Amazon.ECR.Model.InvalidLayerException"> /// The layer digest calculation performed by Amazon ECR upon receipt of the image layer /// does not match the digest specified. /// </exception> /// <exception cref="Amazon.ECR.Model.InvalidParameterException"> /// The specified parameter is invalid. Review the available parameters for the API request. /// </exception> /// <exception cref="Amazon.ECR.Model.LayerAlreadyExistsException"> /// The image layer already exists in the associated repository. /// </exception> /// <exception cref="Amazon.ECR.Model.LayerPartTooSmallException"> /// Layer parts must be at least 5 MiB in size. /// </exception> /// <exception cref="Amazon.ECR.Model.RepositoryNotFoundException"> /// The specified repository could not be found. Check the spelling of the specified repository /// and ensure that you are performing operations on the correct registry. /// </exception> /// <exception cref="Amazon.ECR.Model.ServerException"> /// These errors are usually caused by a server-side issue. /// </exception> /// <exception cref="Amazon.ECR.Model.UploadNotFoundException"> /// The upload could not be found, or the specified upload id is not valid for this repository. /// </exception> public CompleteLayerUploadResponse CompleteLayerUpload(CompleteLayerUploadRequest request) { var marshaller = new CompleteLayerUploadRequestMarshaller(); var unmarshaller = CompleteLayerUploadResponseUnmarshaller.Instance; return Invoke<CompleteLayerUploadRequest,CompleteLayerUploadResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CompleteLayerUpload operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CompleteLayerUpload operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<CompleteLayerUploadResponse> CompleteLayerUploadAsync(CompleteLayerUploadRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CompleteLayerUploadRequestMarshaller(); var unmarshaller = CompleteLayerUploadResponseUnmarshaller.Instance; return InvokeAsync<CompleteLayerUploadRequest,CompleteLayerUploadResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the CompleteLayerUpload operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CompleteLayerUpload operation on AmazonECRClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCompleteLayerUpload /// operation.</returns> public IAsyncResult BeginCompleteLayerUpload(CompleteLayerUploadRequest request, AsyncCallback callback, object state) { var marshaller = new CompleteLayerUploadRequestMarshaller(); var unmarshaller = CompleteLayerUploadResponseUnmarshaller.Instance; return BeginInvoke<CompleteLayerUploadRequest>(request, marshaller, unmarshaller, callback, state); }