Example #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.CodeGuruProfiler.Model.CreateProfilingGroupRequest();


            // populate AgentOrchestrationConfig
            var requestAgentOrchestrationConfigIsNull = true;

            request.AgentOrchestrationConfig = new Amazon.CodeGuruProfiler.Model.AgentOrchestrationConfig();
            System.Boolean?requestAgentOrchestrationConfig_agentOrchestrationConfig_ProfilingEnabled = null;
            if (cmdletContext.AgentOrchestrationConfig_ProfilingEnabled != null)
            {
                requestAgentOrchestrationConfig_agentOrchestrationConfig_ProfilingEnabled = cmdletContext.AgentOrchestrationConfig_ProfilingEnabled.Value;
            }
            if (requestAgentOrchestrationConfig_agentOrchestrationConfig_ProfilingEnabled != null)
            {
                request.AgentOrchestrationConfig.ProfilingEnabled = requestAgentOrchestrationConfig_agentOrchestrationConfig_ProfilingEnabled.Value;
                requestAgentOrchestrationConfigIsNull             = false;
            }
            // determine if request.AgentOrchestrationConfig should be set to null
            if (requestAgentOrchestrationConfigIsNull)
            {
                request.AgentOrchestrationConfig = null;
            }
            if (cmdletContext.ClientToken != null)
            {
                request.ClientToken = cmdletContext.ClientToken;
            }
            if (cmdletContext.ProfilingGroupName != null)
            {
                request.ProfilingGroupName = cmdletContext.ProfilingGroupName;
            }

            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);
        }
Example #2
0
 private Amazon.CodeGuruProfiler.Model.CreateProfilingGroupResponse CallAWSServiceOperation(IAmazonCodeGuruProfiler client, Amazon.CodeGuruProfiler.Model.CreateProfilingGroupRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CodeGuru Profiler", "CreateProfilingGroup");
     try
     {
         #if DESKTOP
         return(client.CreateProfilingGroup(request));
         #elif CORECLR
         return(client.CreateProfilingGroupAsync(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;
     }
 }