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

            if (cmdletContext.TagSpecification != null)
            {
                request.TagSpecifications = cmdletContext.TagSpecification;
            }
            if (cmdletContext.TransitGatewayId != null)
            {
                request.TransitGatewayId = cmdletContext.TransitGatewayId;
            }

            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);
        }
Beispiel #2
0
 private Amazon.EC2.Model.CreateTransitGatewayMulticastDomainResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.CreateTransitGatewayMulticastDomainRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "CreateTransitGatewayMulticastDomain");
     try
     {
         #if DESKTOP
         return(client.CreateTransitGatewayMulticastDomain(request));
         #elif CORECLR
         return(client.CreateTransitGatewayMulticastDomainAsync(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;
     }
 }
Beispiel #3
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.EC2.Model.CreateTransitGatewayMulticastDomainRequest();


            // populate Options
            var requestOptionsIsNull = true;

            request.Options = new Amazon.EC2.Model.CreateTransitGatewayMulticastDomainRequestOptions();
            Amazon.EC2.AutoAcceptSharedAssociationsValue requestOptions_options_AutoAcceptSharedAssociation = null;
            if (cmdletContext.Options_AutoAcceptSharedAssociation != null)
            {
                requestOptions_options_AutoAcceptSharedAssociation = cmdletContext.Options_AutoAcceptSharedAssociation;
            }
            if (requestOptions_options_AutoAcceptSharedAssociation != null)
            {
                request.Options.AutoAcceptSharedAssociations = requestOptions_options_AutoAcceptSharedAssociation;
                requestOptionsIsNull = false;
            }
            Amazon.EC2.Igmpv2SupportValue requestOptions_options_Igmpv2Support = null;
            if (cmdletContext.Options_Igmpv2Support != null)
            {
                requestOptions_options_Igmpv2Support = cmdletContext.Options_Igmpv2Support;
            }
            if (requestOptions_options_Igmpv2Support != null)
            {
                request.Options.Igmpv2Support = requestOptions_options_Igmpv2Support;
                requestOptionsIsNull          = false;
            }
            Amazon.EC2.StaticSourcesSupportValue requestOptions_options_StaticSourcesSupport = null;
            if (cmdletContext.Options_StaticSourcesSupport != null)
            {
                requestOptions_options_StaticSourcesSupport = cmdletContext.Options_StaticSourcesSupport;
            }
            if (requestOptions_options_StaticSourcesSupport != null)
            {
                request.Options.StaticSourcesSupport = requestOptions_options_StaticSourcesSupport;
                requestOptionsIsNull = false;
            }
            // determine if request.Options should be set to null
            if (requestOptionsIsNull)
            {
                request.Options = null;
            }
            if (cmdletContext.TagSpecification != null)
            {
                request.TagSpecifications = cmdletContext.TagSpecification;
            }
            if (cmdletContext.TransitGatewayId != null)
            {
                request.TransitGatewayId = cmdletContext.TransitGatewayId;
            }

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