1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package rds 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/rds/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Enables ingress to a DBSecurityGroup using one of two forms of authorization. 15// First, EC2 or VPC security groups can be added to the DBSecurityGroup if the 16// application using the database is running on EC2 or VPC instances. Second, IP 17// ranges are available if the application accessing your database is running on 18// the Internet. Required parameters for this API are one of CIDR range, 19// EC2SecurityGroupId for VPC, or (EC2SecurityGroupOwnerId and either 20// EC2SecurityGroupName or EC2SecurityGroupId for non-VPC). You can't authorize 21// ingress from an EC2 security group in one AWS Region to an Amazon RDS DB 22// instance in another. You can't authorize ingress from a VPC security group in 23// one VPC to an Amazon RDS DB instance in another. For an overview of CIDR ranges, 24// go to the Wikipedia Tutorial 25// (http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). 26func (c *Client) AuthorizeDBSecurityGroupIngress(ctx context.Context, params *AuthorizeDBSecurityGroupIngressInput, optFns ...func(*Options)) (*AuthorizeDBSecurityGroupIngressOutput, error) { 27 if params == nil { 28 params = &AuthorizeDBSecurityGroupIngressInput{} 29 } 30 31 result, metadata, err := c.invokeOperation(ctx, "AuthorizeDBSecurityGroupIngress", params, optFns, addOperationAuthorizeDBSecurityGroupIngressMiddlewares) 32 if err != nil { 33 return nil, err 34 } 35 36 out := result.(*AuthorizeDBSecurityGroupIngressOutput) 37 out.ResultMetadata = metadata 38 return out, nil 39} 40 41// 42type AuthorizeDBSecurityGroupIngressInput struct { 43 44 // The name of the DB security group to add authorization to. 45 // 46 // This member is required. 47 DBSecurityGroupName *string 48 49 // The IP range to authorize. 50 CIDRIP *string 51 52 // Id of the EC2 security group to authorize. For VPC DB security groups, 53 // EC2SecurityGroupId must be provided. Otherwise, EC2SecurityGroupOwnerId and 54 // either EC2SecurityGroupName or EC2SecurityGroupId must be provided. 55 EC2SecurityGroupId *string 56 57 // Name of the EC2 security group to authorize. For VPC DB security groups, 58 // EC2SecurityGroupId must be provided. Otherwise, EC2SecurityGroupOwnerId and 59 // either EC2SecurityGroupName or EC2SecurityGroupId must be provided. 60 EC2SecurityGroupName *string 61 62 // AWS account number of the owner of the EC2 security group specified in the 63 // EC2SecurityGroupName parameter. The AWS access key ID isn't an acceptable value. 64 // For VPC DB security groups, EC2SecurityGroupId must be provided. Otherwise, 65 // EC2SecurityGroupOwnerId and either EC2SecurityGroupName or EC2SecurityGroupId 66 // must be provided. 67 EC2SecurityGroupOwnerId *string 68} 69 70type AuthorizeDBSecurityGroupIngressOutput struct { 71 72 // Contains the details for an Amazon RDS DB security group. This data type is used 73 // as a response element in the DescribeDBSecurityGroups action. 74 DBSecurityGroup *types.DBSecurityGroup 75 76 // Metadata pertaining to the operation's result. 77 ResultMetadata middleware.Metadata 78} 79 80func addOperationAuthorizeDBSecurityGroupIngressMiddlewares(stack *middleware.Stack, options Options) (err error) { 81 err = stack.Serialize.Add(&awsAwsquery_serializeOpAuthorizeDBSecurityGroupIngress{}, middleware.After) 82 if err != nil { 83 return err 84 } 85 err = stack.Deserialize.Add(&awsAwsquery_deserializeOpAuthorizeDBSecurityGroupIngress{}, middleware.After) 86 if err != nil { 87 return err 88 } 89 if err = addSetLoggerMiddleware(stack, options); err != nil { 90 return err 91 } 92 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 93 return err 94 } 95 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 96 return err 97 } 98 if err = addResolveEndpointMiddleware(stack, options); err != nil { 99 return err 100 } 101 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 102 return err 103 } 104 if err = addRetryMiddlewares(stack, options); err != nil { 105 return err 106 } 107 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 108 return err 109 } 110 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 111 return err 112 } 113 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 114 return err 115 } 116 if err = addClientUserAgent(stack); err != nil { 117 return err 118 } 119 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 120 return err 121 } 122 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 123 return err 124 } 125 if err = addOpAuthorizeDBSecurityGroupIngressValidationMiddleware(stack); err != nil { 126 return err 127 } 128 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAuthorizeDBSecurityGroupIngress(options.Region), middleware.Before); err != nil { 129 return err 130 } 131 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 132 return err 133 } 134 if err = addResponseErrorMiddleware(stack); err != nil { 135 return err 136 } 137 if err = addRequestResponseLogging(stack, options); err != nil { 138 return err 139 } 140 return nil 141} 142 143func newServiceMetadataMiddleware_opAuthorizeDBSecurityGroupIngress(region string) *awsmiddleware.RegisterServiceMetadata { 144 return &awsmiddleware.RegisterServiceMetadata{ 145 Region: region, 146 ServiceID: ServiceID, 147 SigningName: "rds", 148 OperationName: "AuthorizeDBSecurityGroupIngress", 149 } 150} 151