/// <summary> /// Creates a new Configuration. /// </summary> /// <param name="request">The request object containing the details to send. Required.</param> /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param> /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param> /// <returns>A response object containing details about the completed operation</returns> /// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/mysql/CreateConfiguration.cs.html">here</a> to see an example of how to use CreateConfiguration API.</example> public async Task <CreateConfigurationResponse> CreateConfiguration(CreateConfigurationRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default) { logger.Trace("Called createConfiguration"); Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/configurations".Trim('/'))); HttpMethod method = new HttpMethod("POST"); HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request); requestMessage.Headers.Add("Accept", "application/json"); GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration); HttpResponseMessage responseMessage; try { if (retryingClient != null) { responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false); } else { responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false); } this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage); return(Converter.FromHttpResponseMessage <CreateConfigurationResponse>(responseMessage)); } catch (Exception e) { logger.Error($"CreateConfiguration failed with error: {e.Message}"); throw; } }
internal virtual CreateConfigurationResponse CreateConfiguration(CreateConfigurationRequest request) { var marshaller = CreateConfigurationRequestMarshaller.Instance; var unmarshaller = CreateConfigurationResponseUnmarshaller.Instance; return(Invoke <CreateConfigurationRequest, CreateConfigurationResponse>(request, marshaller, unmarshaller)); }
public async Task <APIResponse.APIResponse> CreateConfiguration(CreateConfigurationRequest model) { try { Configuration configurationModel = _mapper.Map <Configuration>(model); configurationModel.CreatedBy = "admin"; configurationModel.CreatedOn = DateTime.Now; bool IsAdded = await _IConfigureRepository.AddAsync(configurationModel); if (IsAdded) { response.StatusCode = StaticResource.StaticResource.failStatusCode; response.Message = StaticResource.StaticResource.ConfigurationCreated; } else { response.StatusCode = StaticResource.StaticResource.failStatusCode; response.Message = StaticResource.StaticResource.ConfigurationNotCreated; } } catch (Exception ex) { response.StatusCode = StaticResource.StaticResource.failStatusCode; response.Message = StaticResource.StaticResource.SomethingWrong; } return(response); }
protected StoredSettings CreateProofAndSettingsChain() { var settings = new ChainSettings(Version: ChainSettings.VersionEnum.NUMBER_1, Secret: Encoding.UTF8.GetBytes("very secret")) { HashAlgorithm = ChainSettings.HashAlgorithmEnum._256, ContentRegistrationChainTypes = new List <ChainSettings.ContentRegistrationChainTypesEnum> { ChainSettings.ContentRegistrationChainTypesEnum.PERHASHPROOFCHAIN, ChainSettings.ContentRegistrationChainTypesEnum.SINGLEPROOFCHAIN } }; var createConfiguration = new CreateConfigurationRequest(Name: ExampleConfigName, InitialSettings: settings, Context: TestContextMultichain, AccessMode: CreateConfigurationRequest.AccessModeEnum.PRIVATE); var configurationResponse = _configurationApi.CreateConfiguration(createConfiguration); var storedSettings = configurationResponse.StoredSettings; Assert.NotNull(storedSettings); Assert.NotNull(storedSettings.Context); Assert.NotNull(storedSettings.ChainSettings); Assert.NotNull(storedSettings.SingleProofChain); Assert.NotNull(storedSettings.SettingsChain); Assert.NotNull(storedSettings.ChainConfiguration); Assert.NotNull(storedSettings.ChainSettings.SingleProofChain); Assert.NotNull(storedSettings.ChainSettings.HashAlgorithm); SettingsChainId = storedSettings.SettingsChain.ChainId; ProofChainId = storedSettings.SingleProofChain.ChainId; return(storedSettings); }
/// <summary> /// Initiates the asynchronous execution of the CreateConfiguration operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateConfiguration 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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mq-2017-11-27/CreateConfiguration">REST API Reference for CreateConfiguration Operation</seealso> public virtual Task <CreateConfigurationResponse> CreateConfigurationAsync(CreateConfigurationRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = CreateConfigurationRequestMarshaller.Instance; var unmarshaller = CreateConfigurationResponseUnmarshaller.Instance; return(InvokeAsync <CreateConfigurationRequest, CreateConfigurationResponse>(request, marshaller, unmarshaller, cancellationToken)); }
public async Task <CreateConfigurationResponse> CreateConfiguration(CreateConfigurationRequest o) { var result = new CreateConfigurationResponse(o.RequestId); result.Created = await Server.CreateSettings(o.Application, o.Key, o.Value); return(result); }
/// <summary> /// 创建参数模板 /// </summary> public async Task <CreateConfigurationResponse> CreateConfigurationAsync(CreateConfigurationRequest createConfigurationRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); string urlPath = HttpUtils.AddUrlPath("/v3/{project_id}/configurations", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json", createConfigurationRequest); HttpResponseMessage response = await DoHttpRequestAsync("POST", request); return(JsonUtils.DeSerialize <CreateConfigurationResponse>(response)); }
/// <summary> /// Initiates the asynchronous execution of the CreateConfiguration operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateConfiguration 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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/kafka-2018-11-14/CreateConfiguration">REST API Reference for CreateConfiguration Operation</seealso> public virtual Task <CreateConfigurationResponse> CreateConfigurationAsync(CreateConfigurationRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = CreateConfigurationRequestMarshaller.Instance; options.ResponseUnmarshaller = CreateConfigurationResponseUnmarshaller.Instance; return(InvokeAsync <CreateConfigurationResponse>(request, options, cancellationToken)); }
/// <summary> /// Creates a new MSK configuration. /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateConfiguration service method.</param> /// /// <returns>The response from the CreateConfiguration service method, as returned by Kafka.</returns> /// <exception cref="Amazon.Kafka.Model.BadRequestException"> /// Returns information about an error. /// </exception> /// <exception cref="Amazon.Kafka.Model.ConflictException"> /// Returns information about an error. /// </exception> /// <exception cref="Amazon.Kafka.Model.ForbiddenException"> /// Returns information about an error. /// </exception> /// <exception cref="Amazon.Kafka.Model.InternalServerErrorException"> /// Returns information about an error. /// </exception> /// <exception cref="Amazon.Kafka.Model.ServiceUnavailableException"> /// Returns information about an error. /// </exception> /// <exception cref="Amazon.Kafka.Model.TooManyRequestsException"> /// Returns information about an error. /// </exception> /// <exception cref="Amazon.Kafka.Model.UnauthorizedException"> /// Returns information about an error. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/kafka-2018-11-14/CreateConfiguration">REST API Reference for CreateConfiguration Operation</seealso> public virtual CreateConfigurationResponse CreateConfiguration(CreateConfigurationRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = CreateConfigurationRequestMarshaller.Instance; options.ResponseUnmarshaller = CreateConfigurationResponseUnmarshaller.Instance; return(Invoke <CreateConfigurationResponse>(request, options)); }
public async Task <IActionResult> CreateConfiguration([FromBody] CreateConfigurationRequest model) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } response = await _clientService.CreateConfiguration(model); var json = JsonConvert.SerializeObject(response, _serializerSettings); return(new OkObjectResult(json)); } catch { throw; } }
public async Task <IActionResult> Post([FromRoute] Request meta, [FromBody] CreateConfigurationRequest request) { IActionResult result = null; var id = await Server.Create(meta.Application, request.Key, request.Value); if (id != Guid.Empty) { result = Factory.CreateSuccessResponse(id); } else { result = Factory.CreateNoContentResponse(); } return(result); }
protected override void ProcessRecord() { base.ProcessRecord(); CreateConfigurationRequest request; try { request = new CreateConfigurationRequest { CreateConfigurationDetails = CreateConfigurationDetails, OpcRequestId = OpcRequestId, OpcRetryToken = OpcRetryToken }; response = client.CreateConfiguration(request).GetAwaiter().GetResult(); WriteOutput(response, response.Configuration); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// Create a new configuration Create a new configuration /// </summary> /// <exception cref="Sphereon.SDK.Blockchain.Proof.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="request">Create a new Proof of Existence configuration using the provided settings. The context points to a context of the Easy Blockchain API. When you have no own context, simply use 'multichain' without the quotes as context. You will be using our multichain ledger then, which is recomended during development/testing</param> /// <returns>ApiResponse of ConfigurationResponse</returns> public ApiResponse <ConfigurationResponse> CreateConfigurationWithHttpInfo(CreateConfigurationRequest request) { // verify the required parameter 'request' is set if (request == null) { throw new ApiException(400, "Missing required parameter 'request' when calling ConfigurationApi->CreateConfiguration"); } var localVarPath = "/config"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new Dictionary <String, String>(); var localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json;charset=UTF-8" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json;charset=UTF-8" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (request != null && request.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(request); // http body (model) parameter } else { localVarPostBody = request; // byte array } // authentication (oauth2schema) required // oauth required if (!String.IsNullOrEmpty(Configuration.AccessToken)) { localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("CreateConfiguration", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <ConfigurationResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (ConfigurationResponse)Configuration.ApiClient.Deserialize(localVarResponse, typeof(ConfigurationResponse)))); }
/// <summary> /// Create a new configuration Create a new configuration /// </summary> /// <exception cref="Sphereon.SDK.Blockchain.Proof.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="request">Create a new Proof of Existence configuration using the provided settings. The context points to a context of the Easy Blockchain API. When you have no own context, simply use 'multichain' without the quotes as context. You will be using our multichain ledger then, which is recomended during development/testing</param> /// <returns>ConfigurationResponse</returns> public ConfigurationResponse CreateConfiguration(CreateConfigurationRequest request) { ApiResponse <ConfigurationResponse> localVarResponse = CreateConfigurationWithHttpInfo(request); return(localVarResponse.Data); }
public async Task <ActionResult> Create([FromBody] CreateConfigurationRequest request) { var response = await _mediator.Send(request); return(Ok(response)); }
/// <summary> /// Create a new configuration Create a new configuration /// </summary> /// <exception cref="Sphereon.SDK.Blockchain.Proof.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="request">Create a new Proof of Existence configuration using the provided settings. The context points to a context of the Easy Blockchain API. When you have no own context, simply use 'multichain' without the quotes as context. You will be using our multichain ledger then, which is recomended during development/testing</param> /// <returns>Task of ConfigurationResponse</returns> public async System.Threading.Tasks.Task <ConfigurationResponse> CreateConfigurationAsync(CreateConfigurationRequest request) { ApiResponse <ConfigurationResponse> localVarResponse = await CreateConfigurationAsyncWithHttpInfo(request); return(localVarResponse.Data); }