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

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

            // populate Options
            var requestOptionsIsNull = true;

            request.Options = new Amazon.EC2.Model.ModifyTransitGatewayOptions();
            List <System.String> requestOptions_options_AddTransitGatewayCidrBlock = null;

            if (cmdletContext.Options_AddTransitGatewayCidrBlock != null)
            {
                requestOptions_options_AddTransitGatewayCidrBlock = cmdletContext.Options_AddTransitGatewayCidrBlock;
            }
            if (requestOptions_options_AddTransitGatewayCidrBlock != null)
            {
                request.Options.AddTransitGatewayCidrBlocks = requestOptions_options_AddTransitGatewayCidrBlock;
                requestOptionsIsNull = false;
            }
            System.String requestOptions_options_AssociationDefaultRouteTableId = null;
            if (cmdletContext.Options_AssociationDefaultRouteTableId != null)
            {
                requestOptions_options_AssociationDefaultRouteTableId = cmdletContext.Options_AssociationDefaultRouteTableId;
            }
            if (requestOptions_options_AssociationDefaultRouteTableId != null)
            {
                request.Options.AssociationDefaultRouteTableId = requestOptions_options_AssociationDefaultRouteTableId;
                requestOptionsIsNull = false;
            }
            Amazon.EC2.AutoAcceptSharedAttachmentsValue requestOptions_options_AutoAcceptSharedAttachment = null;
            if (cmdletContext.Options_AutoAcceptSharedAttachment != null)
            {
                requestOptions_options_AutoAcceptSharedAttachment = cmdletContext.Options_AutoAcceptSharedAttachment;
            }
            if (requestOptions_options_AutoAcceptSharedAttachment != null)
            {
                request.Options.AutoAcceptSharedAttachments = requestOptions_options_AutoAcceptSharedAttachment;
                requestOptionsIsNull = false;
            }
            Amazon.EC2.DefaultRouteTableAssociationValue requestOptions_options_DefaultRouteTableAssociation = null;
            if (cmdletContext.Options_DefaultRouteTableAssociation != null)
            {
                requestOptions_options_DefaultRouteTableAssociation = cmdletContext.Options_DefaultRouteTableAssociation;
            }
            if (requestOptions_options_DefaultRouteTableAssociation != null)
            {
                request.Options.DefaultRouteTableAssociation = requestOptions_options_DefaultRouteTableAssociation;
                requestOptionsIsNull = false;
            }
            Amazon.EC2.DefaultRouteTablePropagationValue requestOptions_options_DefaultRouteTablePropagation = null;
            if (cmdletContext.Options_DefaultRouteTablePropagation != null)
            {
                requestOptions_options_DefaultRouteTablePropagation = cmdletContext.Options_DefaultRouteTablePropagation;
            }
            if (requestOptions_options_DefaultRouteTablePropagation != null)
            {
                request.Options.DefaultRouteTablePropagation = requestOptions_options_DefaultRouteTablePropagation;
                requestOptionsIsNull = false;
            }
            Amazon.EC2.DnsSupportValue requestOptions_options_DnsSupport = null;
            if (cmdletContext.Options_DnsSupport != null)
            {
                requestOptions_options_DnsSupport = cmdletContext.Options_DnsSupport;
            }
            if (requestOptions_options_DnsSupport != null)
            {
                request.Options.DnsSupport = requestOptions_options_DnsSupport;
                requestOptionsIsNull       = false;
            }
            System.String requestOptions_options_PropagationDefaultRouteTableId = null;
            if (cmdletContext.Options_PropagationDefaultRouteTableId != null)
            {
                requestOptions_options_PropagationDefaultRouteTableId = cmdletContext.Options_PropagationDefaultRouteTableId;
            }
            if (requestOptions_options_PropagationDefaultRouteTableId != null)
            {
                request.Options.PropagationDefaultRouteTableId = requestOptions_options_PropagationDefaultRouteTableId;
                requestOptionsIsNull = false;
            }
            List <System.String> requestOptions_options_RemoveTransitGatewayCidrBlock = null;

            if (cmdletContext.Options_RemoveTransitGatewayCidrBlock != null)
            {
                requestOptions_options_RemoveTransitGatewayCidrBlock = cmdletContext.Options_RemoveTransitGatewayCidrBlock;
            }
            if (requestOptions_options_RemoveTransitGatewayCidrBlock != null)
            {
                request.Options.RemoveTransitGatewayCidrBlocks = requestOptions_options_RemoveTransitGatewayCidrBlock;
                requestOptionsIsNull = false;
            }
            Amazon.EC2.VpnEcmpSupportValue requestOptions_options_VpnEcmpSupport = null;
            if (cmdletContext.Options_VpnEcmpSupport != null)
            {
                requestOptions_options_VpnEcmpSupport = cmdletContext.Options_VpnEcmpSupport;
            }
            if (requestOptions_options_VpnEcmpSupport != null)
            {
                request.Options.VpnEcmpSupport = requestOptions_options_VpnEcmpSupport;
                requestOptionsIsNull           = false;
            }
            // determine if request.Options should be set to null
            if (requestOptionsIsNull)
            {
                request.Options = null;
            }
            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);
        }
示例#2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.EC2.Model.CreateTransitGatewayVpcAttachmentRequest();


            // populate Options
            var requestOptionsIsNull = true;

            request.Options = new Amazon.EC2.Model.CreateTransitGatewayVpcAttachmentRequestOptions();
            Amazon.EC2.ApplianceModeSupportValue requestOptions_options_ApplianceModeSupport = null;
            if (cmdletContext.Options_ApplianceModeSupport != null)
            {
                requestOptions_options_ApplianceModeSupport = cmdletContext.Options_ApplianceModeSupport;
            }
            if (requestOptions_options_ApplianceModeSupport != null)
            {
                request.Options.ApplianceModeSupport = requestOptions_options_ApplianceModeSupport;
                requestOptionsIsNull = false;
            }
            Amazon.EC2.DnsSupportValue requestOptions_options_DnsSupport = null;
            if (cmdletContext.Options_DnsSupport != null)
            {
                requestOptions_options_DnsSupport = cmdletContext.Options_DnsSupport;
            }
            if (requestOptions_options_DnsSupport != null)
            {
                request.Options.DnsSupport = requestOptions_options_DnsSupport;
                requestOptionsIsNull       = false;
            }
            Amazon.EC2.Ipv6SupportValue requestOptions_options_Ipv6Support = null;
            if (cmdletContext.Options_Ipv6Support != null)
            {
                requestOptions_options_Ipv6Support = cmdletContext.Options_Ipv6Support;
            }
            if (requestOptions_options_Ipv6Support != null)
            {
                request.Options.Ipv6Support = requestOptions_options_Ipv6Support;
                requestOptionsIsNull        = false;
            }
            // determine if request.Options should be set to null
            if (requestOptionsIsNull)
            {
                request.Options = null;
            }
            if (cmdletContext.SubnetId != null)
            {
                request.SubnetIds = cmdletContext.SubnetId;
            }
            if (cmdletContext.TagSpecification != null)
            {
                request.TagSpecifications = cmdletContext.TagSpecification;
            }
            if (cmdletContext.TransitGatewayId != null)
            {
                request.TransitGatewayId = cmdletContext.TransitGatewayId;
            }
            if (cmdletContext.VpcId != null)
            {
                request.VpcId = cmdletContext.VpcId;
            }

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