async Task <string> ISwarmOperations.InitSwarmAsync(SwarmInitParameters parameters, CancellationToken cancellationToken) { var data = new JsonRequestContent <SwarmInitParameters>(parameters ?? throw new ArgumentNullException(nameof(parameters)), this._client.JsonSerializer); var response = await this._client.MakeRequestAsync(new[] { SwarmResponseHandler }, HttpMethod.Post, "swarm/init", null, data, cancellationToken).ConfigureAwait(false); return(response.Body); }
public async Task <String> createSwarmAsync(String advertiseAddr, String listenAddr) { SwarmInitParameters parameters = new SwarmInitParameters(); parameters.AdvertiseAddr = advertiseAddr; parameters.ListenAddr = listenAddr; CancellationToken cancellationToken = new CancellationToken(); return(await this.client.Swarm.InitSwarmAsync(parameters, cancellationToken)); }
async Task <string> ISwarmOperations.InitSwarmAsync(SwarmInitParameters parameters, CancellationToken cancellationToken) { var data = new JsonRequestContent <SwarmInitParameters>(parameters ?? throw new ArgumentNullException(nameof(parameters)), this._client.JsonSerializer); var response = await this._client.MakeRequestAsync( new ApiResponseErrorHandlingDelegate[] { (statusCode, responseBody) => { if (statusCode == HttpStatusCode.NotAcceptable) { // TODO: Make typed error. throw new Exception("Node is already part of a swarm."); } } }, HttpMethod.Post, "swarm/init", null, data, cancellationToken).ConfigureAwait(false); return(response.Body); }
public async Task <string> InitCluster(SwarmInitParameters initParameters) { return(await _client.Swarm.InitSwarmAsync(initParameters)); }
public async Task <string> InitSwarm(SwarmInitParameters swarmPrm) { var result = await _client.Swarm.InitSwarmAsync(swarmPrm); return(result); }