public Task CreateImageAsync(ImagesCreateParameters parameters, Stream imageStream, AuthConfig authConfig, IDictionary <string, string> headers, IProgress <JSONMessage> progress, CancellationToken cancellationToken = default(CancellationToken)) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } HttpMethod httpMethod = HttpMethod.Post; BinaryRequestContent content = null; if (imageStream != null) { content = new BinaryRequestContent(imageStream, TarContentType); parameters.FromSrc = ImportFromBodySource; } IQueryString queryParameters = new QueryString <ImagesCreateParameters>(parameters); Dictionary <string, string> customHeaders = RegistryAuthHeaders(authConfig); if (headers != null) { foreach (string key in headers.Keys) { customHeaders[key] = headers[key]; } } return(StreamUtil.MonitorResponseForMessagesAsync( this._client.MakeRequestForRawResponseAsync(httpMethod, "images/create", queryParameters, content, customHeaders, cancellationToken), this._client, cancellationToken, progress)); }
public Task BuildImageFromDockerfileAsync(ImageBuildParameters parameters, Stream contents, IEnumerable <AuthConfig> authConfigs, IDictionary <string, string> headers, IProgress <JSONMessage> progress, CancellationToken cancellationToken = default) { if (contents == null) { throw new ArgumentNullException(nameof(contents)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } HttpMethod httpMethod = HttpMethod.Post; var data = new BinaryRequestContent(contents, TarContentType); IQueryString queryParameters = new QueryString <ImageBuildParameters>(parameters); Dictionary <string, string> customHeaders = RegistryConfigHeaders(authConfigs); if (headers != null) { foreach (string key in headers.Keys) { customHeaders[key] = headers[key]; } } return(StreamUtil.MonitorResponseForMessagesAsync( this._client.MakeRequestForRawResponseAsync( httpMethod, "build", queryParameters, data, customHeaders, cancellationToken), this._client, cancellationToken, progress )); }