private Amazon.Greengrass.Model.CreateFunctionDefinitionVersionResponse CallAWSServiceOperation(IAmazonGreengrass client, Amazon.Greengrass.Model.CreateFunctionDefinitionVersionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Greengrass", "CreateFunctionDefinitionVersion"); try { #if DESKTOP return(client.CreateFunctionDefinitionVersion(request)); #elif CORECLR return(client.CreateFunctionDefinitionVersionAsync(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.Greengrass.Model.CreateFunctionDefinitionVersionRequest(); if (cmdletContext.AmznClientToken != null) { request.AmznClientToken = cmdletContext.AmznClientToken; } // populate DefaultConfig var requestDefaultConfigIsNull = true; request.DefaultConfig = new Amazon.Greengrass.Model.FunctionDefaultConfig(); Amazon.Greengrass.Model.FunctionDefaultExecutionConfig requestDefaultConfig_defaultConfig_Execution = null; // populate Execution var requestDefaultConfig_defaultConfig_ExecutionIsNull = true; requestDefaultConfig_defaultConfig_Execution = new Amazon.Greengrass.Model.FunctionDefaultExecutionConfig(); Amazon.Greengrass.FunctionIsolationMode requestDefaultConfig_defaultConfig_Execution_execution_IsolationMode = null; if (cmdletContext.Execution_IsolationMode != null) { requestDefaultConfig_defaultConfig_Execution_execution_IsolationMode = cmdletContext.Execution_IsolationMode; } if (requestDefaultConfig_defaultConfig_Execution_execution_IsolationMode != null) { requestDefaultConfig_defaultConfig_Execution.IsolationMode = requestDefaultConfig_defaultConfig_Execution_execution_IsolationMode; requestDefaultConfig_defaultConfig_ExecutionIsNull = false; } Amazon.Greengrass.Model.FunctionRunAsConfig requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs = null; // populate RunAs var requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAsIsNull = true; requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs = new Amazon.Greengrass.Model.FunctionRunAsConfig(); System.Int32?requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs_runAs_Gid = null; if (cmdletContext.RunAs_Gid != null) { requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs_runAs_Gid = cmdletContext.RunAs_Gid.Value; } if (requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs_runAs_Gid != null) { requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs.Gid = requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs_runAs_Gid.Value; requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAsIsNull = false; } System.Int32?requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs_runAs_Uid = null; if (cmdletContext.RunAs_Uid != null) { requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs_runAs_Uid = cmdletContext.RunAs_Uid.Value; } if (requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs_runAs_Uid != null) { requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs.Uid = requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs_runAs_Uid.Value; requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAsIsNull = false; } // determine if requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs should be set to null if (requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAsIsNull) { requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs = null; } if (requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs != null) { requestDefaultConfig_defaultConfig_Execution.RunAs = requestDefaultConfig_defaultConfig_Execution_defaultConfig_Execution_RunAs; requestDefaultConfig_defaultConfig_ExecutionIsNull = false; } // determine if requestDefaultConfig_defaultConfig_Execution should be set to null if (requestDefaultConfig_defaultConfig_ExecutionIsNull) { requestDefaultConfig_defaultConfig_Execution = null; } if (requestDefaultConfig_defaultConfig_Execution != null) { request.DefaultConfig.Execution = requestDefaultConfig_defaultConfig_Execution; requestDefaultConfigIsNull = false; } // determine if request.DefaultConfig should be set to null if (requestDefaultConfigIsNull) { request.DefaultConfig = null; } if (cmdletContext.FunctionDefinitionId != null) { request.FunctionDefinitionId = cmdletContext.FunctionDefinitionId; } if (cmdletContext.Function != null) { request.Functions = cmdletContext.Function; } 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); }