github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/vpc/getSecurityGroupRule.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package vpc 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // `vpc.getSecurityGroupRule` provides details about a specific security group rule. 15 // 16 // ## Example Usage 17 // 18 // <!--Start PulumiCodeChooser --> 19 // ```go 20 // package main 21 // 22 // import ( 23 // 24 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/vpc" 25 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 26 // 27 // ) 28 // 29 // func main() { 30 // pulumi.Run(func(ctx *pulumi.Context) error { 31 // _, err := vpc.GetSecurityGroupRule(ctx, &vpc.GetSecurityGroupRuleArgs{ 32 // SecurityGroupRuleId: pulumi.StringRef(securityGroupRuleId), 33 // }, nil) 34 // if err != nil { 35 // return err 36 // } 37 // return nil 38 // }) 39 // } 40 // 41 // ``` 42 // <!--End PulumiCodeChooser --> 43 func GetSecurityGroupRule(ctx *pulumi.Context, args *GetSecurityGroupRuleArgs, opts ...pulumi.InvokeOption) (*GetSecurityGroupRuleResult, error) { 44 opts = internal.PkgInvokeDefaultOpts(opts) 45 var rv GetSecurityGroupRuleResult 46 err := ctx.Invoke("aws:vpc/getSecurityGroupRule:getSecurityGroupRule", args, &rv, opts...) 47 if err != nil { 48 return nil, err 49 } 50 return &rv, nil 51 } 52 53 // A collection of arguments for invoking getSecurityGroupRule. 54 type GetSecurityGroupRuleArgs struct { 55 // Configuration block(s) for filtering. Detailed below. 56 Filters []GetSecurityGroupRuleFilter `pulumi:"filters"` 57 // ID of the security group rule to select. 58 SecurityGroupRuleId *string `pulumi:"securityGroupRuleId"` 59 } 60 61 // A collection of values returned by getSecurityGroupRule. 62 type GetSecurityGroupRuleResult struct { 63 // The Amazon Resource Name (ARN) of the security group rule. 64 Arn string `pulumi:"arn"` 65 // The destination IPv4 CIDR range. 66 CidrIpv4 string `pulumi:"cidrIpv4"` 67 // The destination IPv6 CIDR range. 68 CidrIpv6 string `pulumi:"cidrIpv6"` 69 // The security group rule description. 70 Description string `pulumi:"description"` 71 Filters []GetSecurityGroupRuleFilter `pulumi:"filters"` 72 // The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type. 73 FromPort int `pulumi:"fromPort"` 74 Id string `pulumi:"id"` 75 // The IP protocol name or number. Use `-1` to specify all protocols. 76 IpProtocol string `pulumi:"ipProtocol"` 77 // Indicates whether the security group rule is an outbound rule. 78 IsEgress bool `pulumi:"isEgress"` 79 // The ID of the destination prefix list. 80 PrefixListId string `pulumi:"prefixListId"` 81 // The destination security group that is referenced in the rule. 82 ReferencedSecurityGroupId string `pulumi:"referencedSecurityGroupId"` 83 // The ID of the security group. 84 SecurityGroupId string `pulumi:"securityGroupId"` 85 SecurityGroupRuleId string `pulumi:"securityGroupRuleId"` 86 // A map of tags assigned to the resource. 87 Tags map[string]string `pulumi:"tags"` 88 // (Optional) The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code. 89 ToPort int `pulumi:"toPort"` 90 } 91 92 func GetSecurityGroupRuleOutput(ctx *pulumi.Context, args GetSecurityGroupRuleOutputArgs, opts ...pulumi.InvokeOption) GetSecurityGroupRuleResultOutput { 93 return pulumi.ToOutputWithContext(context.Background(), args). 94 ApplyT(func(v interface{}) (GetSecurityGroupRuleResult, error) { 95 args := v.(GetSecurityGroupRuleArgs) 96 r, err := GetSecurityGroupRule(ctx, &args, opts...) 97 var s GetSecurityGroupRuleResult 98 if r != nil { 99 s = *r 100 } 101 return s, err 102 }).(GetSecurityGroupRuleResultOutput) 103 } 104 105 // A collection of arguments for invoking getSecurityGroupRule. 106 type GetSecurityGroupRuleOutputArgs struct { 107 // Configuration block(s) for filtering. Detailed below. 108 Filters GetSecurityGroupRuleFilterArrayInput `pulumi:"filters"` 109 // ID of the security group rule to select. 110 SecurityGroupRuleId pulumi.StringPtrInput `pulumi:"securityGroupRuleId"` 111 } 112 113 func (GetSecurityGroupRuleOutputArgs) ElementType() reflect.Type { 114 return reflect.TypeOf((*GetSecurityGroupRuleArgs)(nil)).Elem() 115 } 116 117 // A collection of values returned by getSecurityGroupRule. 118 type GetSecurityGroupRuleResultOutput struct{ *pulumi.OutputState } 119 120 func (GetSecurityGroupRuleResultOutput) ElementType() reflect.Type { 121 return reflect.TypeOf((*GetSecurityGroupRuleResult)(nil)).Elem() 122 } 123 124 func (o GetSecurityGroupRuleResultOutput) ToGetSecurityGroupRuleResultOutput() GetSecurityGroupRuleResultOutput { 125 return o 126 } 127 128 func (o GetSecurityGroupRuleResultOutput) ToGetSecurityGroupRuleResultOutputWithContext(ctx context.Context) GetSecurityGroupRuleResultOutput { 129 return o 130 } 131 132 // The Amazon Resource Name (ARN) of the security group rule. 133 func (o GetSecurityGroupRuleResultOutput) Arn() pulumi.StringOutput { 134 return o.ApplyT(func(v GetSecurityGroupRuleResult) string { return v.Arn }).(pulumi.StringOutput) 135 } 136 137 // The destination IPv4 CIDR range. 138 func (o GetSecurityGroupRuleResultOutput) CidrIpv4() pulumi.StringOutput { 139 return o.ApplyT(func(v GetSecurityGroupRuleResult) string { return v.CidrIpv4 }).(pulumi.StringOutput) 140 } 141 142 // The destination IPv6 CIDR range. 143 func (o GetSecurityGroupRuleResultOutput) CidrIpv6() pulumi.StringOutput { 144 return o.ApplyT(func(v GetSecurityGroupRuleResult) string { return v.CidrIpv6 }).(pulumi.StringOutput) 145 } 146 147 // The security group rule description. 148 func (o GetSecurityGroupRuleResultOutput) Description() pulumi.StringOutput { 149 return o.ApplyT(func(v GetSecurityGroupRuleResult) string { return v.Description }).(pulumi.StringOutput) 150 } 151 152 func (o GetSecurityGroupRuleResultOutput) Filters() GetSecurityGroupRuleFilterArrayOutput { 153 return o.ApplyT(func(v GetSecurityGroupRuleResult) []GetSecurityGroupRuleFilter { return v.Filters }).(GetSecurityGroupRuleFilterArrayOutput) 154 } 155 156 // The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type. 157 func (o GetSecurityGroupRuleResultOutput) FromPort() pulumi.IntOutput { 158 return o.ApplyT(func(v GetSecurityGroupRuleResult) int { return v.FromPort }).(pulumi.IntOutput) 159 } 160 161 func (o GetSecurityGroupRuleResultOutput) Id() pulumi.StringOutput { 162 return o.ApplyT(func(v GetSecurityGroupRuleResult) string { return v.Id }).(pulumi.StringOutput) 163 } 164 165 // The IP protocol name or number. Use `-1` to specify all protocols. 166 func (o GetSecurityGroupRuleResultOutput) IpProtocol() pulumi.StringOutput { 167 return o.ApplyT(func(v GetSecurityGroupRuleResult) string { return v.IpProtocol }).(pulumi.StringOutput) 168 } 169 170 // Indicates whether the security group rule is an outbound rule. 171 func (o GetSecurityGroupRuleResultOutput) IsEgress() pulumi.BoolOutput { 172 return o.ApplyT(func(v GetSecurityGroupRuleResult) bool { return v.IsEgress }).(pulumi.BoolOutput) 173 } 174 175 // The ID of the destination prefix list. 176 func (o GetSecurityGroupRuleResultOutput) PrefixListId() pulumi.StringOutput { 177 return o.ApplyT(func(v GetSecurityGroupRuleResult) string { return v.PrefixListId }).(pulumi.StringOutput) 178 } 179 180 // The destination security group that is referenced in the rule. 181 func (o GetSecurityGroupRuleResultOutput) ReferencedSecurityGroupId() pulumi.StringOutput { 182 return o.ApplyT(func(v GetSecurityGroupRuleResult) string { return v.ReferencedSecurityGroupId }).(pulumi.StringOutput) 183 } 184 185 // The ID of the security group. 186 func (o GetSecurityGroupRuleResultOutput) SecurityGroupId() pulumi.StringOutput { 187 return o.ApplyT(func(v GetSecurityGroupRuleResult) string { return v.SecurityGroupId }).(pulumi.StringOutput) 188 } 189 190 func (o GetSecurityGroupRuleResultOutput) SecurityGroupRuleId() pulumi.StringOutput { 191 return o.ApplyT(func(v GetSecurityGroupRuleResult) string { return v.SecurityGroupRuleId }).(pulumi.StringOutput) 192 } 193 194 // A map of tags assigned to the resource. 195 func (o GetSecurityGroupRuleResultOutput) Tags() pulumi.StringMapOutput { 196 return o.ApplyT(func(v GetSecurityGroupRuleResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput) 197 } 198 199 // (Optional) The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code. 200 func (o GetSecurityGroupRuleResultOutput) ToPort() pulumi.IntOutput { 201 return o.ApplyT(func(v GetSecurityGroupRuleResult) int { return v.ToPort }).(pulumi.IntOutput) 202 } 203 204 func init() { 205 pulumi.RegisterOutputType(GetSecurityGroupRuleResultOutput{}) 206 }