/// <summary> /// The RevokeSecurityGroupIngress operation revokes permissions from a security /// group. The permissions used to revoke must be specified using the same values /// used to grant the permissions. /// Permissions are specified by IP protocol (TCP, UDP, or ICMP), the source of the /// request (by IP range or an Amazon EC2 user-group pair), the source and /// destination port ranges (for TCP and UDP), and the ICMP codes and types (for /// ICMP). /// Permission changes are quickly propagated to instances within the security /// group. However, depending on the number of instances in the group, a small /// delay is might occur, . /// When revoking a user/group pair permission, GroupName, SourceSecurityGroupName /// and SourceSecurityGroupOwnerId must be specified. When authorizing a CIDR IP /// permission, GroupName, IpProtocol, FromPort, ToPort and CidrIp must be /// specified. Mixing these two types of parameters is not allowed. /// /// </summary> /// <param name="service">Instance of AmazonEC2 service</param> /// <param name="request">RevokeSecurityGroupIngressRequest request</param> public static void InvokeRevokeSecurityGroupIngress(AmazonEC2 service, RevokeSecurityGroupIngressRequest request) { try { RevokeSecurityGroupIngressResponse response = service.RevokeSecurityGroupIngress(request); Console.WriteLine ("Service Response"); Console.WriteLine ("============================================================================="); Console.WriteLine (); Console.WriteLine(" RevokeSecurityGroupIngressResponse"); if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } } catch (AmazonEC2Exception ex) { Console.WriteLine("Caught Exception: " + ex.Message); Console.WriteLine("Response Status Code: " + ex.StatusCode); Console.WriteLine("Error Code: " + ex.ErrorCode); Console.WriteLine("Error Type: " + ex.ErrorType); Console.WriteLine("Request ID: " + ex.RequestId); Console.WriteLine("XML: " + ex.XML); } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.RevokeSecurityGroupIngressRequest(); if (cmdletContext.GroupId != null) { request.GroupId = cmdletContext.GroupId; } if (cmdletContext.GroupName != null) { request.GroupName = cmdletContext.GroupName; } if (cmdletContext.IpPermission != null) { request.IpPermissions = cmdletContext.IpPermission; } if (cmdletContext.SecurityGroupRuleId != null) { request.SecurityGroupRuleIds = cmdletContext.SecurityGroupRuleId; } 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> /// Removes one or more ingress rules from a security group. The values that you specify /// in the revoke request (for example, ports) must match the existing rule's values for /// the rule to be removed. /// /// /// <para> /// Each rule consists of the protocol and the CIDR range or source security group. For /// the TCP and UDP protocols, you must also specify the destination port or range of /// ports. For the ICMP protocol, you must also specify the ICMP type and code. /// </para> /// /// <para> /// Rule changes are propagated to instances within the security group as quickly as possible. /// However, a small delay might occur. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the RevokeSecurityGroupIngress service method.</param> /// /// <returns>The response from the RevokeSecurityGroupIngress service method, as returned by EC2.</returns> public RevokeSecurityGroupIngressResponse RevokeSecurityGroupIngress(RevokeSecurityGroupIngressRequest request) { var marshaller = new RevokeSecurityGroupIngressRequestMarshaller(); var unmarshaller = RevokeSecurityGroupIngressResponseUnmarshaller.Instance; return Invoke<RevokeSecurityGroupIngressRequest,RevokeSecurityGroupIngressResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the RevokeSecurityGroupIngress operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RevokeSecurityGroupIngress 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<RevokeSecurityGroupIngressResponse> RevokeSecurityGroupIngressAsync(RevokeSecurityGroupIngressRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new RevokeSecurityGroupIngressRequestMarshaller(); var unmarshaller = RevokeSecurityGroupIngressResponseUnmarshaller.Instance; return InvokeAsync<RevokeSecurityGroupIngressRequest,RevokeSecurityGroupIngressResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the RevokeSecurityGroupIngress operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RevokeSecurityGroupIngress 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 EndRevokeSecurityGroupIngress /// operation.</returns> public IAsyncResult BeginRevokeSecurityGroupIngress(RevokeSecurityGroupIngressRequest request, AsyncCallback callback, object state) { var marshaller = new RevokeSecurityGroupIngressRequestMarshaller(); var unmarshaller = RevokeSecurityGroupIngressResponseUnmarshaller.Instance; return BeginInvoke<RevokeSecurityGroupIngressRequest>(request, marshaller, unmarshaller, callback, state); }
IAsyncResult invokeRevokeSecurityGroupIngress(RevokeSecurityGroupIngressRequest revokeSecurityGroupIngressRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new RevokeSecurityGroupIngressRequestMarshaller().Marshall(revokeSecurityGroupIngressRequest); var unmarshaller = RevokeSecurityGroupIngressResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the RevokeSecurityGroupIngress operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.RevokeSecurityGroupIngress"/> /// </summary> /// /// <param name="revokeSecurityGroupIngressRequest">Container for the necessary parameters to execute the RevokeSecurityGroupIngress 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 BeginRevokeSecurityGroupIngress(RevokeSecurityGroupIngressRequest revokeSecurityGroupIngressRequest, AsyncCallback callback, object state) { return invokeRevokeSecurityGroupIngress(revokeSecurityGroupIngressRequest, callback, state, false); }
/// <summary> /// <para>Removes one or more ingress rules from a security group. The values that you specify in the revoke request (for example, ports) must /// match the existing rule's values for the rule to be removed.</para> <para>Each rule consists of the protocol and the CIDR range or source /// security group. For the TCP and UDP protocols, you must also specify the destination port or range of ports. For the ICMP protocol, you must /// also specify the ICMP type and code.</para> <para>Rule changes are propagated to instances within the security group as quickly as possible. /// However, a small delay might occur.</para> /// </summary> /// /// <param name="revokeSecurityGroupIngressRequest">Container for the necessary parameters to execute the RevokeSecurityGroupIngress service /// method on AmazonEC2.</param> /// public RevokeSecurityGroupIngressResponse RevokeSecurityGroupIngress(RevokeSecurityGroupIngressRequest revokeSecurityGroupIngressRequest) { IAsyncResult asyncResult = invokeRevokeSecurityGroupIngress(revokeSecurityGroupIngressRequest, null, null, true); return EndRevokeSecurityGroupIngress(asyncResult); }
/// <summary> /// <para>Removes one or more ingress rules from a security group. The values that you specify in the revoke request (for example, ports) must /// match the existing rule's values for the rule to be removed.</para> <para>Each rule consists of the protocol and the CIDR range or source /// security group. For the TCP and UDP protocols, you must also specify the destination port or range of ports. For the ICMP protocol, you must /// also specify the ICMP type and code.</para> <para>Rule changes are propagated to instances within the security group as quickly as possible. /// However, a small delay might occur.</para> /// </summary> /// /// <param name="revokeSecurityGroupIngressRequest">Container for the necessary parameters to execute the RevokeSecurityGroupIngress service /// method on AmazonEC2.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<RevokeSecurityGroupIngressResponse> RevokeSecurityGroupIngressAsync(RevokeSecurityGroupIngressRequest revokeSecurityGroupIngressRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new RevokeSecurityGroupIngressRequestMarshaller(); var unmarshaller = RevokeSecurityGroupIngressResponseUnmarshaller.GetInstance(); return Invoke<IRequest, RevokeSecurityGroupIngressRequest, RevokeSecurityGroupIngressResponse>(revokeSecurityGroupIngressRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal RevokeSecurityGroupIngressResponse RevokeSecurityGroupIngress(RevokeSecurityGroupIngressRequest request) { var task = RevokeSecurityGroupIngressAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the RevokeSecurityGroupIngress operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.RevokeSecurityGroupIngress"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RevokeSecurityGroupIngress 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 async Task<RevokeSecurityGroupIngressResponse> RevokeSecurityGroupIngressAsync(RevokeSecurityGroupIngressRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new RevokeSecurityGroupIngressRequestMarshaller(); var unmarshaller = RevokeSecurityGroupIngressResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, RevokeSecurityGroupIngressRequest, RevokeSecurityGroupIngressResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para> The RevokeSecurityGroupIngress operation revokes permissions from a security group. The permissions used to revoke must be specified /// using the same values used to grant the permissions. </para> <para> Permissions are specified by IP protocol (TCP, UDP, or ICMP), the source /// of the request (by IP range or an Amazon EC2 user-group pair), the source and destination port ranges (for TCP and UDP), and the ICMP codes /// and types (for ICMP). </para> <para> Permission changes are quickly propagated to instances within the security group. However, depending on /// the number of instances in the group, a small delay might occur. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RevokeSecurityGroupIngress service /// method on AmazonEC2.</param> public RevokeSecurityGroupIngressResponse RevokeSecurityGroupIngress(RevokeSecurityGroupIngressRequest request) { var task = RevokeSecurityGroupIngressAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
private Amazon.EC2.Model.RevokeSecurityGroupIngressResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.RevokeSecurityGroupIngressRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "RevokeSecurityGroupIngress"); try { #if DESKTOP return(client.RevokeSecurityGroupIngress(request)); #elif CORECLR return(client.RevokeSecurityGroupIngressAsync(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; } }