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