示例#1
0
 private Amazon.DirectConnect.Model.AllocateTransitVirtualInterfaceResponse CallAWSServiceOperation(IAmazonDirectConnect client, Amazon.DirectConnect.Model.AllocateTransitVirtualInterfaceRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Direct Connect", "AllocateTransitVirtualInterface");
     try
     {
         #if DESKTOP
         return(client.AllocateTransitVirtualInterface(request));
         #elif CORECLR
         return(client.AllocateTransitVirtualInterfaceAsync(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;
     }
 }
示例#2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.DirectConnect.Model.AllocateTransitVirtualInterfaceRequest();

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

            // populate NewTransitVirtualInterfaceAllocation
            var requestNewTransitVirtualInterfaceAllocationIsNull = true;

            request.NewTransitVirtualInterfaceAllocation = new Amazon.DirectConnect.Model.NewTransitVirtualInterfaceAllocation();
            Amazon.DirectConnect.AddressFamily requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_AddressFamily = null;
            if (cmdletContext.NewTransitVirtualInterfaceAllocation_AddressFamily != null)
            {
                requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_AddressFamily = cmdletContext.NewTransitVirtualInterfaceAllocation_AddressFamily;
            }
            if (requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_AddressFamily != null)
            {
                request.NewTransitVirtualInterfaceAllocation.AddressFamily = requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_AddressFamily;
                requestNewTransitVirtualInterfaceAllocationIsNull          = false;
            }
            System.String requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_AmazonAddress = null;
            if (cmdletContext.NewTransitVirtualInterfaceAllocation_AmazonAddress != null)
            {
                requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_AmazonAddress = cmdletContext.NewTransitVirtualInterfaceAllocation_AmazonAddress;
            }
            if (requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_AmazonAddress != null)
            {
                request.NewTransitVirtualInterfaceAllocation.AmazonAddress = requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_AmazonAddress;
                requestNewTransitVirtualInterfaceAllocationIsNull          = false;
            }
            System.Int32?requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Asn = null;
            if (cmdletContext.NewTransitVirtualInterfaceAllocation_Asn != null)
            {
                requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Asn = cmdletContext.NewTransitVirtualInterfaceAllocation_Asn.Value;
            }
            if (requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Asn != null)
            {
                request.NewTransitVirtualInterfaceAllocation.Asn  = requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Asn.Value;
                requestNewTransitVirtualInterfaceAllocationIsNull = false;
            }
            System.String requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_AuthKey = null;
            if (cmdletContext.NewTransitVirtualInterfaceAllocation_AuthKey != null)
            {
                requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_AuthKey = cmdletContext.NewTransitVirtualInterfaceAllocation_AuthKey;
            }
            if (requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_AuthKey != null)
            {
                request.NewTransitVirtualInterfaceAllocation.AuthKey = requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_AuthKey;
                requestNewTransitVirtualInterfaceAllocationIsNull    = false;
            }
            System.String requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_CustomerAddress = null;
            if (cmdletContext.NewTransitVirtualInterfaceAllocation_CustomerAddress != null)
            {
                requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_CustomerAddress = cmdletContext.NewTransitVirtualInterfaceAllocation_CustomerAddress;
            }
            if (requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_CustomerAddress != null)
            {
                request.NewTransitVirtualInterfaceAllocation.CustomerAddress = requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_CustomerAddress;
                requestNewTransitVirtualInterfaceAllocationIsNull            = false;
            }
            System.Int32?requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Mtu = null;
            if (cmdletContext.NewTransitVirtualInterfaceAllocation_Mtu != null)
            {
                requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Mtu = cmdletContext.NewTransitVirtualInterfaceAllocation_Mtu.Value;
            }
            if (requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Mtu != null)
            {
                request.NewTransitVirtualInterfaceAllocation.Mtu  = requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Mtu.Value;
                requestNewTransitVirtualInterfaceAllocationIsNull = false;
            }
            List <Amazon.DirectConnect.Model.Tag> requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Tag = null;

            if (cmdletContext.NewTransitVirtualInterfaceAllocation_Tag != null)
            {
                requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Tag = cmdletContext.NewTransitVirtualInterfaceAllocation_Tag;
            }
            if (requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Tag != null)
            {
                request.NewTransitVirtualInterfaceAllocation.Tags = requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Tag;
                requestNewTransitVirtualInterfaceAllocationIsNull = false;
            }
            System.String requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_VirtualInterfaceName = null;
            if (cmdletContext.NewTransitVirtualInterfaceAllocation_VirtualInterfaceName != null)
            {
                requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_VirtualInterfaceName = cmdletContext.NewTransitVirtualInterfaceAllocation_VirtualInterfaceName;
            }
            if (requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_VirtualInterfaceName != null)
            {
                request.NewTransitVirtualInterfaceAllocation.VirtualInterfaceName = requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_VirtualInterfaceName;
                requestNewTransitVirtualInterfaceAllocationIsNull = false;
            }
            System.Int32?requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Vlan = null;
            if (cmdletContext.NewTransitVirtualInterfaceAllocation_Vlan != null)
            {
                requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Vlan = cmdletContext.NewTransitVirtualInterfaceAllocation_Vlan.Value;
            }
            if (requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Vlan != null)
            {
                request.NewTransitVirtualInterfaceAllocation.Vlan = requestNewTransitVirtualInterfaceAllocation_newTransitVirtualInterfaceAllocation_Vlan.Value;
                requestNewTransitVirtualInterfaceAllocationIsNull = false;
            }
            // determine if request.NewTransitVirtualInterfaceAllocation should be set to null
            if (requestNewTransitVirtualInterfaceAllocationIsNull)
            {
                request.NewTransitVirtualInterfaceAllocation = null;
            }
            if (cmdletContext.OwnerAccount != null)
            {
                request.OwnerAccount = cmdletContext.OwnerAccount;
            }

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