private Amazon.IoTThingsGraph.Model.CreateFlowTemplateResponse CallAWSServiceOperation(IAmazonIoTThingsGraph client, Amazon.IoTThingsGraph.Model.CreateFlowTemplateRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS IoT Things Graph", "CreateFlowTemplate"); try { #if DESKTOP return(client.CreateFlowTemplate(request)); #elif CORECLR return(client.CreateFlowTemplateAsync(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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.IoTThingsGraph.Model.CreateFlowTemplateRequest(); if (cmdletContext.CompatibleNamespaceVersion != null) { request.CompatibleNamespaceVersion = cmdletContext.CompatibleNamespaceVersion.Value; } // populate Definition var requestDefinitionIsNull = true; request.Definition = new Amazon.IoTThingsGraph.Model.DefinitionDocument(); Amazon.IoTThingsGraph.DefinitionLanguage requestDefinition_definition_Language = null; if (cmdletContext.Definition_Language != null) { requestDefinition_definition_Language = cmdletContext.Definition_Language; } if (requestDefinition_definition_Language != null) { request.Definition.Language = requestDefinition_definition_Language; requestDefinitionIsNull = false; } System.String requestDefinition_definition_Text = null; if (cmdletContext.Definition_Text != null) { requestDefinition_definition_Text = cmdletContext.Definition_Text; } if (requestDefinition_definition_Text != null) { request.Definition.Text = requestDefinition_definition_Text; requestDefinitionIsNull = false; } // determine if request.Definition should be set to null if (requestDefinitionIsNull) { request.Definition = null; } 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); }