1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package ec2
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/ec2/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// [VPC only] Removes the specified egress rules from a security group for EC2-VPC.
15// This action does not apply to security groups for use in EC2-Classic. To remove
16// a rule, the values that you specify (for example, ports) must match the existing
17// rule's values exactly. [Default VPC] If the values you specify do not match the
18// existing rule's values, no error is returned, and the output describes the
19// security group rules that were not revoked. AWS recommends that you use
20// DescribeSecurityGroups to verify that the rule has been removed. Each rule
21// consists of the protocol and the IPv4 or IPv6 CIDR range or source security
22// group. For the TCP and UDP protocols, you must also specify the destination port
23// or range of ports. For the ICMP protocol, you must also specify the ICMP type
24// and code. If the security group rule has a description, you do not have to
25// specify the description to revoke the rule. Rule changes are propagated to
26// instances within the security group as quickly as possible. However, a small
27// delay might occur.
28func (c *Client) RevokeSecurityGroupEgress(ctx context.Context, params *RevokeSecurityGroupEgressInput, optFns ...func(*Options)) (*RevokeSecurityGroupEgressOutput, error) {
29	if params == nil {
30		params = &RevokeSecurityGroupEgressInput{}
31	}
32
33	result, metadata, err := c.invokeOperation(ctx, "RevokeSecurityGroupEgress", params, optFns, addOperationRevokeSecurityGroupEgressMiddlewares)
34	if err != nil {
35		return nil, err
36	}
37
38	out := result.(*RevokeSecurityGroupEgressOutput)
39	out.ResultMetadata = metadata
40	return out, nil
41}
42
43type RevokeSecurityGroupEgressInput struct {
44
45	// The ID of the security group.
46	//
47	// This member is required.
48	GroupId *string
49
50	// Not supported. Use a set of IP permissions to specify the CIDR.
51	CidrIp *string
52
53	// Checks whether you have the required permissions for the action, without
54	// actually making the request, and provides an error response. If you have the
55	// required permissions, the error response is DryRunOperation. Otherwise, it is
56	// UnauthorizedOperation.
57	DryRun *bool
58
59	// Not supported. Use a set of IP permissions to specify the port.
60	FromPort *int32
61
62	// The sets of IP permissions. You can't specify a destination security group and a
63	// CIDR IP address range in the same set of permissions.
64	IpPermissions []types.IpPermission
65
66	// Not supported. Use a set of IP permissions to specify the protocol name or
67	// number.
68	IpProtocol *string
69
70	// Not supported. Use a set of IP permissions to specify a destination security
71	// group.
72	SourceSecurityGroupName *string
73
74	// Not supported. Use a set of IP permissions to specify a destination security
75	// group.
76	SourceSecurityGroupOwnerId *string
77
78	// Not supported. Use a set of IP permissions to specify the port.
79	ToPort *int32
80}
81
82type RevokeSecurityGroupEgressOutput struct {
83
84	// Returns true if the request succeeds; otherwise, returns an error.
85	Return *bool
86
87	// The outbound rules that were unknown to the service. In some cases,
88	// unknownIpPermissionSet might be in a different format from the request
89	// parameter.
90	UnknownIpPermissions []types.IpPermission
91
92	// Metadata pertaining to the operation's result.
93	ResultMetadata middleware.Metadata
94}
95
96func addOperationRevokeSecurityGroupEgressMiddlewares(stack *middleware.Stack, options Options) (err error) {
97	err = stack.Serialize.Add(&awsEc2query_serializeOpRevokeSecurityGroupEgress{}, middleware.After)
98	if err != nil {
99		return err
100	}
101	err = stack.Deserialize.Add(&awsEc2query_deserializeOpRevokeSecurityGroupEgress{}, middleware.After)
102	if err != nil {
103		return err
104	}
105	if err = addSetLoggerMiddleware(stack, options); err != nil {
106		return err
107	}
108	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
109		return err
110	}
111	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
112		return err
113	}
114	if err = addResolveEndpointMiddleware(stack, options); err != nil {
115		return err
116	}
117	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
118		return err
119	}
120	if err = addRetryMiddlewares(stack, options); err != nil {
121		return err
122	}
123	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
124		return err
125	}
126	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
127		return err
128	}
129	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
130		return err
131	}
132	if err = addClientUserAgent(stack); err != nil {
133		return err
134	}
135	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
136		return err
137	}
138	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
139		return err
140	}
141	if err = addOpRevokeSecurityGroupEgressValidationMiddleware(stack); err != nil {
142		return err
143	}
144	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRevokeSecurityGroupEgress(options.Region), middleware.Before); err != nil {
145		return err
146	}
147	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
148		return err
149	}
150	if err = addResponseErrorMiddleware(stack); err != nil {
151		return err
152	}
153	if err = addRequestResponseLogging(stack, options); err != nil {
154		return err
155	}
156	return nil
157}
158
159func newServiceMetadataMiddleware_opRevokeSecurityGroupEgress(region string) *awsmiddleware.RegisterServiceMetadata {
160	return &awsmiddleware.RegisterServiceMetadata{
161		Region:        region,
162		ServiceID:     ServiceID,
163		SigningName:   "ec2",
164		OperationName: "RevokeSecurityGroupEgress",
165	}
166}
167