public static void Run() { // For example purposes create template if not exists. TemplateUtils.CreateIfNotExist("templates/template-for-companies.json"); var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey); var apiInstance = new TemplateApi(configuration); try { var options = new TemplateOptions { StorageName = Common.MyStorage, TemplatePath = "templates/template-for-companies.json" }; var request = new GetTemplateRequest(options); // could be used in parse by template method var template = apiInstance.GetTemplate(request); foreach (var field in template.Fields) { Console.WriteLine($"Field: {field.FieldName}"); } foreach (var table in template.Tables) { Console.WriteLine($"Table: {table.TableName}"); } } catch (Exception e) { Console.WriteLine("Exception while calling TemplateApi: " + e.Message); } }
/// <summary> /// Initiates the asynchronous execution of the GetTemplate operation. /// <seealso cref="Amazon.CloudFormation.IAmazonCloudFormation.GetTemplate"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetTemplate 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 <GetTemplateResponse> GetTemplateAsync(GetTemplateRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetTemplateRequestMarshaller(); var unmarshaller = GetTemplateResponseUnmarshaller.GetInstance(); return(Invoke <IRequest, GetTemplateRequest, GetTemplateResponse>(request, marshaller, unmarshaller, signer, cancellationToken)); }
public GetTemplateResponse GetTemplate(GetTemplateRequest request) { return(DataContext.DashboardTemplates.Include(x => x.LayoutRows) .Include(x => x.LayoutRows.Select(y => y.LayoutColumns)) .Include(x => x.LayoutRows.Select(y => y.LayoutColumns.Select(z => z.Artifact))) .FirstOrDefault(x => x.Id == request.Id).MapTo <GetTemplateResponse>()); }
internal GetTemplateResponse GetTemplate(GetTemplateRequest request) { var marshaller = new GetTemplateRequestMarshaller(); var unmarshaller = GetTemplateResponseUnmarshaller.Instance; return(Invoke <GetTemplateRequest, GetTemplateResponse>(request, marshaller, unmarshaller)); }
/// <summary> /// <para>Returns the template body for a specified stack name. You can get the template for running or deleted stacks.</para> <para>For deleted /// stacks, GetTemplate returns the template for up to 90 days after the stack has been deleted. </para> <para><b>NOTE:</b> If the template does /// not exist, a ValidationError is returned. </para> /// </summary> /// /// <param name="getTemplateRequest">Container for the necessary parameters to execute the GetTemplate service method on /// AmazonCloudFormation.</param> /// /// <returns>The response from the GetTemplate service method, as returned by AmazonCloudFormation.</returns> /// public GetTemplateResponse GetTemplate(GetTemplateRequest getTemplateRequest) { IRequest <GetTemplateRequest> request = new GetTemplateRequestMarshaller().Marshall(getTemplateRequest); GetTemplateResponse response = Invoke <GetTemplateRequest, GetTemplateResponse> (request, this.signer, GetTemplateResponseUnmarshaller.GetInstance()); return(response); }
public void GetTemplateRequestObject() { moq::Mock <TemplatesService.TemplatesServiceClient> mockGrpcClient = new moq::Mock <TemplatesService.TemplatesServiceClient>(moq::MockBehavior.Strict); GetTemplateRequest request = new GetTemplateRequest { ProjectId = "project_id43ad98b0", GcsPath = "gcs_path83b28bb9", View = GetTemplateRequest.Types.TemplateView.MetadataOnly, Location = "locatione09d18d5", }; GetTemplateResponse expectedResponse = new GetTemplateResponse { Status = new gr::Status(), Metadata = new TemplateMetadata(), TemplateType = GetTemplateResponse.Types.TemplateType.Flex, RuntimeMetadata = new RuntimeMetadata(), }; mockGrpcClient.Setup(x => x.GetTemplate(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); TemplatesServiceClient client = new TemplatesServiceClientImpl(mockGrpcClient.Object, null); GetTemplateResponse response = client.GetTemplate(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public GetTemplateRequestTests() { var request = new GetTemplateRequest("me-templ"); var response = this._client.GetTemplate(request); this._status = response.ConnectionStatus; }
/// <summary> /// Retrieve document template. /// </summary> /// <param name="request">Request. <see cref="GetTemplateRequest" /></param> /// <returns><see cref="Template"/></returns> public Template GetTemplate(GetTemplateRequest request) { // verify the required parameter 'options' is set if (request.options == null) { throw new ApiException(400, "Missing required parameter 'options' when calling GetTemplate"); } // create path and map variables var resourcePath = this.configuration.GetServerUrl() + "/parser/template"; resourcePath = Regex .Replace(resourcePath, "\\*", string.Empty) .Replace("&", "&") .Replace("/?", "?"); var postBody = SerializationHelper.Serialize(request.options); // http body (model) parameter var response = this.apiInvoker.InvokeApi( resourcePath, "POST", postBody, null, null); if (response != null) { return((Template)SerializationHelper.Deserialize(response, typeof(Template))); } return(null); }
public async stt::Task GetTemplateRequestObjectAsync() { moq::Mock <TemplatesService.TemplatesServiceClient> mockGrpcClient = new moq::Mock <TemplatesService.TemplatesServiceClient>(moq::MockBehavior.Strict); GetTemplateRequest request = new GetTemplateRequest { ProjectId = "project_id43ad98b0", GcsPath = "gcs_path83b28bb9", View = GetTemplateRequest.Types.TemplateView.MetadataOnly, Location = "locatione09d18d5", }; GetTemplateResponse expectedResponse = new GetTemplateResponse { Status = new gr::Status(), Metadata = new TemplateMetadata(), TemplateType = GetTemplateResponse.Types.TemplateType.Flex, RuntimeMetadata = new RuntimeMetadata(), }; mockGrpcClient.Setup(x => x.GetTemplateAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <GetTemplateResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); TemplatesServiceClient client = new TemplatesServiceClientImpl(mockGrpcClient.Object, null); GetTemplateResponse responseCallSettings = await client.GetTemplateAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); GetTemplateResponse responseCancellationToken = await client.GetTemplateAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary> /// Initiates the asynchronous execution of the GetTemplate operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetTemplate 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 <GetTemplateResponse> GetTemplateAsync(GetTemplateRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetTemplateRequestMarshaller(); var unmarshaller = GetTemplateResponseUnmarshaller.Instance; return(InvokeAsync <GetTemplateRequest, GetTemplateResponse>(request, marshaller, unmarshaller, cancellationToken)); }
public static GeneralResponse <string> GetTemplateRequest(GetTemplateRequest model) { var request = SetHeaders($"/account/downloadTemplate/{model.TemplateType.ToString()}/{model.Title}", accessToken); request.Method = Method.GET; var response = Client.Execute(request); return(response.Parse <string>()); }
public void TestTemplate_Get_WithoutOptions() { var options = new TemplateOptions(); var request = new GetTemplateRequest(options); var ex = Assert.Throws <ApiException>(() => { TemplateApi.GetTemplate(request); }); Assert.AreEqual("Request parameters missing or have incorrect format", ex.Message); }
/// <summary> /// Creates a waiter using the provided configuration. /// </summary> /// <param name="request">Request to send.</param> /// <param name="config">Wait Configuration</param> /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param> /// <returns>a new Oci.common.Waiter instance</returns> public Waiter <GetTemplateRequest, GetTemplateResponse> ForTemplate(GetTemplateRequest request, WaiterConfiguration config, params Template.LifecycleStateEnum[] targetStates) { var agent = new WaiterAgent <GetTemplateRequest, GetTemplateResponse>( request, request => client.GetTemplate(request), response => targetStates.Contains(response.Template.LifecycleState.Value) ); return(new Waiter <GetTemplateRequest, GetTemplateResponse>(config, agent)); }
public void TestTemplate_Get_FileNotFoundResult() { var options = new TemplateOptions() { TemplatePath = "notExistTemplate.json" }; var getRequest = new GetTemplateRequest(options); var ex = Assert.Throws <ApiException>(() => { TemplateApi.GetTemplate(getRequest); }); Assert.AreEqual("Can't find file located at 'notExistTemplate.json'.", ex.Message); }
public async Task <CloudApplicationMetadata> LoadCloudApplicationMetadata(string cloudApplication) { using var client = _awsClientFactory.GetAWSClient <Amazon.CloudFormation.IAmazonCloudFormation>(); var request = new GetTemplateRequest { StackName = cloudApplication }; var response = await client.GetTemplateAsync(request); return(ReadSettings(response.TemplateBody)); }
/// <summary> /// <para>Returns the template body for a specified stack. You can get the template for running or deleted stacks.</para> <para>For deleted /// stacks, GetTemplate returns the template for up to 90 days after the stack has been deleted.</para> <para><b>NOTE:</b> If the template does /// not exist, a ValidationError is returned. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetTemplate service method on /// AmazonCloudFormation.</param> /// /// <returns>The response from the GetTemplate service method, as returned by AmazonCloudFormation.</returns> public GetTemplateResponse GetTemplate(GetTemplateRequest request) { var task = GetTemplateAsync(request); try { return(task.Result); } catch (AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return(null); } }
public async Task <Template> GetTemplate(string templatename) { Template template = new Template(); _gettemprequest = new GetTemplateRequest() { TemplateName = templatename }; _gettempresponse = await _Client.GetTemplateAsync(_gettemprequest); if (_gettempresponse.HttpStatusCode.ToString() == "OK" && _gettempresponse.Template != null) { template = _gettempresponse.Template; } return(template); }
/// <summary>Snippet for GetTemplate</summary> public void GetTemplateRequestObject() { // Snippet: GetTemplate(GetTemplateRequest, CallSettings) // Create client TemplatesServiceClient templatesServiceClient = TemplatesServiceClient.Create(); // Initialize request argument(s) GetTemplateRequest request = new GetTemplateRequest { ProjectId = "", GcsPath = "", View = GetTemplateRequest.Types.TemplateView.MetadataOnly, Location = "", }; // Make the request GetTemplateResponse response = templatesServiceClient.GetTemplate(request); // End snippet }
private void HandleOutput(GetTemplateRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case LifecycleStateParamSet: response = client.Waiters.ForTemplate(request, waiterConfig, WaitForLifecycleState).Execute(); break; case Default: response = client.GetTemplate(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.Template); }
/// <summary>Snippet for GetTemplateAsync</summary> public async Task GetTemplateRequestObjectAsync() { // Snippet: GetTemplateAsync(GetTemplateRequest, CallSettings) // Additional: GetTemplateAsync(GetTemplateRequest, CancellationToken) // Create client TemplatesServiceClient templatesServiceClient = await TemplatesServiceClient.CreateAsync(); // Initialize request argument(s) GetTemplateRequest request = new GetTemplateRequest { ProjectId = "", GcsPath = "", View = GetTemplateRequest.Types.TemplateView.MetadataOnly, Location = "", }; // Make the request GetTemplateResponse response = await templatesServiceClient.GetTemplateAsync(request); // End snippet }
public async Task <Template> GetTemplate(string templatename) { Template template = new Template(); _gettemprequest = new GetTemplateRequest() { TemplateName = templatename }; try { _gettempresponse = await _Client.GetTemplateAsync(_gettemprequest); } catch (TemplateDoesNotExistException ex) { return(null); } if (_gettempresponse.HttpStatusCode.ToString() == "OK" && _gettempresponse.Template != null) { template = _gettempresponse.Template; } return(template); }
protected override void ProcessRecord() { base.ProcessRecord(); GetTemplateRequest request; try { request = new GetTemplateRequest { TemplateId = TemplateId, OpcRequestId = OpcRequestId }; HandleOutput(request); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
public void TestGetTemplate() { var options = new CreateTemplateOptions() { Template = GetTemplate(), TemplatePath = "templates/template_1.json" }; var request = new CreateTemplateRequest(options); var result = TemplateApi.CreateTemplate(request); var getOptions = new TemplateOptions() { TemplatePath = "templates/template_1.json" }; var getRequest = new GetTemplateRequest(getOptions); var getResult = TemplateApi.GetTemplate(getRequest); Assert.IsNotNull(getResult); Assert.IsInstanceOf <Template>(getResult); Assert.AreEqual(2, getResult.Fields.Count); Assert.AreEqual(1, getResult.Tables.Count); }
/// <summary> /// Get the template associated with a template. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override stt::Task <GetTemplateResponse> GetTemplateAsync(GetTemplateRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetTemplateRequest(ref request, ref callSettings); return(_callGetTemplate.Async(request, callSettings)); }
/// <summary> /// Get the template associated with a template. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public override GetTemplateResponse GetTemplate(GetTemplateRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetTemplateRequest(ref request, ref callSettings); return(_callGetTemplate.Sync(request, callSettings)); }
partial void Modify_GetTemplateRequest(ref GetTemplateRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Get the template associated with a template. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <GetTemplateResponse> GetTemplateAsync(GetTemplateRequest request, st::CancellationToken cancellationToken) => GetTemplateAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Get the template associated with a template. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <GetTemplateResponse> GetTemplateAsync(GetTemplateRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
/// <summary> /// Get the template associated with a template. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual GetTemplateResponse GetTemplate(GetTemplateRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
public object Get(GetTemplateRequest request) { return(new GetTemplateResponse { GetSingleResult = request.Name }); }
public GetTemplateRequestTests() { var request = new GetTemplateRequest("me-templ"); var response = this._client.GetTemplate(request); this._status = response.ConnectionStatus; }