Container for the parameters to the ModifySubnetAttribute operation. Modifies a subnet attribute. You can only modify one attribute at a time.
Inheritance: AmazonEC2Request
Example #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.EC2.Model.ModifySubnetAttributeRequest();

            if (cmdletContext.AssignIpv6AddressOnCreation != null)
            {
                request.AssignIpv6AddressOnCreation = cmdletContext.AssignIpv6AddressOnCreation.Value;
            }
            if (cmdletContext.CustomerOwnedIpv4Pool != null)
            {
                request.CustomerOwnedIpv4Pool = cmdletContext.CustomerOwnedIpv4Pool;
            }
            if (cmdletContext.MapCustomerOwnedIpOnLaunch != null)
            {
                request.MapCustomerOwnedIpOnLaunch = cmdletContext.MapCustomerOwnedIpOnLaunch.Value;
            }
            if (cmdletContext.MapPublicIpOnLaunch != null)
            {
                request.MapPublicIpOnLaunch = cmdletContext.MapPublicIpOnLaunch.Value;
            }
            if (cmdletContext.SubnetId != null)
            {
                request.SubnetId = cmdletContext.SubnetId;
            }

            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);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the ModifySubnetAttribute operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ModifySubnetAttribute operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<ModifySubnetAttributeResponse> ModifySubnetAttributeAsync(ModifySubnetAttributeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new ModifySubnetAttributeRequestMarshaller();
            var unmarshaller = ModifySubnetAttributeResponseUnmarshaller.Instance;

            return InvokeAsync<ModifySubnetAttributeRequest,ModifySubnetAttributeResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        /// <summary>
        /// Modifies a subnet attribute.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the ModifySubnetAttribute service method.</param>
        /// 
        /// <returns>The response from the ModifySubnetAttribute service method, as returned by EC2.</returns>
        public ModifySubnetAttributeResponse ModifySubnetAttribute(ModifySubnetAttributeRequest request)
        {
            var marshaller = new ModifySubnetAttributeRequestMarshaller();
            var unmarshaller = ModifySubnetAttributeResponseUnmarshaller.Instance;

            return Invoke<ModifySubnetAttributeRequest,ModifySubnetAttributeResponse>(request, marshaller, unmarshaller);
        }
Example #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the ModifySubnetAttribute operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ModifySubnetAttribute operation on AmazonEC2Client.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndModifySubnetAttribute
        ///         operation.</returns>
        public IAsyncResult BeginModifySubnetAttribute(ModifySubnetAttributeRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new ModifySubnetAttributeRequestMarshaller();
            var unmarshaller = ModifySubnetAttributeResponseUnmarshaller.Instance;

            return BeginInvoke<ModifySubnetAttributeRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
 private Amazon.EC2.Model.ModifySubnetAttributeResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.ModifySubnetAttributeRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "ModifySubnetAttribute");
     try
     {
         #if DESKTOP
         return(client.ModifySubnetAttribute(request));
         #elif CORECLR
         return(client.ModifySubnetAttributeAsync(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;
     }
 }
Example #6
0
        /// <summary>
        /// Initiates the asynchronous execution of the ModifySubnetAttribute operation.
        /// <seealso cref="Amazon.EC2.IAmazonEC2.ModifySubnetAttribute"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ModifySubnetAttribute operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
		public Task<ModifySubnetAttributeResponse> ModifySubnetAttributeAsync(ModifySubnetAttributeRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new ModifySubnetAttributeRequestMarshaller();
            var unmarshaller = ModifySubnetAttributeResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, ModifySubnetAttributeRequest, ModifySubnetAttributeResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }
Example #7
0
        /// <summary>
        /// <para>Modifies a subnet attribute.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ModifySubnetAttribute service method on
        /// AmazonEC2.</param>
		public ModifySubnetAttributeResponse ModifySubnetAttribute(ModifySubnetAttributeRequest request)
        {
            var task = ModifySubnetAttributeAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
Example #8
0
 IAsyncResult invokeModifySubnetAttribute(ModifySubnetAttributeRequest modifySubnetAttributeRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new ModifySubnetAttributeRequestMarshaller().Marshall(modifySubnetAttributeRequest);
     var unmarshaller = ModifySubnetAttributeResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
Example #9
0
 /// <summary>
 /// Initiates the asynchronous execution of the ModifySubnetAttribute operation.
 /// <seealso cref="Amazon.EC2.IAmazonEC2.ModifySubnetAttribute"/>
 /// </summary>
 /// 
 /// <param name="modifySubnetAttributeRequest">Container for the necessary parameters to execute the ModifySubnetAttribute operation on
 ///          AmazonEC2.</param>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public IAsyncResult BeginModifySubnetAttribute(ModifySubnetAttributeRequest modifySubnetAttributeRequest, AsyncCallback callback, object state)
 {
     return invokeModifySubnetAttribute(modifySubnetAttributeRequest, callback, state, false);
 }
Example #10
0
 /// <summary>
 /// <para>Modifies a subnet attribute.</para>
 /// </summary>
 /// 
 /// <param name="modifySubnetAttributeRequest">Container for the necessary parameters to execute the ModifySubnetAttribute service method on
 ///          AmazonEC2.</param>
 /// 
 public ModifySubnetAttributeResponse ModifySubnetAttribute(ModifySubnetAttributeRequest modifySubnetAttributeRequest)
 {
     IAsyncResult asyncResult = invokeModifySubnetAttribute(modifySubnetAttributeRequest, null, null, true);
     return EndModifySubnetAttribute(asyncResult);
 }