Esempio n. 1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.XRay.Model.CreateGroupRequest();

            if (cmdletContext.FilterExpression != null)
            {
                request.FilterExpression = cmdletContext.FilterExpression;
            }
            if (cmdletContext.GroupName != null)
            {
                request.GroupName = cmdletContext.GroupName;
            }

            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);
        }
Esempio n. 2
0
 private Amazon.XRay.Model.CreateGroupResponse CallAWSServiceOperation(IAmazonXRay client, Amazon.XRay.Model.CreateGroupRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS X-Ray", "CreateGroup");
     try
     {
         #if DESKTOP
         return(client.CreateGroup(request));
         #elif CORECLR
         return(client.CreateGroupAsync(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;
     }
 }
Esempio n. 3
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.XRay.Model.CreateGroupRequest();

            if (cmdletContext.FilterExpression != null)
            {
                request.FilterExpression = cmdletContext.FilterExpression;
            }
            if (cmdletContext.GroupName != null)
            {
                request.GroupName = cmdletContext.GroupName;
            }

            // populate InsightsConfiguration
            var requestInsightsConfigurationIsNull = true;

            request.InsightsConfiguration = new Amazon.XRay.Model.InsightsConfiguration();
            System.Boolean?requestInsightsConfiguration_insightsConfiguration_InsightsEnabled = null;
            if (cmdletContext.InsightsConfiguration_InsightsEnabled != null)
            {
                requestInsightsConfiguration_insightsConfiguration_InsightsEnabled = cmdletContext.InsightsConfiguration_InsightsEnabled.Value;
            }
            if (requestInsightsConfiguration_insightsConfiguration_InsightsEnabled != null)
            {
                request.InsightsConfiguration.InsightsEnabled = requestInsightsConfiguration_insightsConfiguration_InsightsEnabled.Value;
                requestInsightsConfigurationIsNull            = false;
            }
            // determine if request.InsightsConfiguration should be set to null
            if (requestInsightsConfigurationIsNull)
            {
                request.InsightsConfiguration = null;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            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);
        }