id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
126,400 | terraform-providers/terraform-provider-aws | aws/structure.go | flattenDynamoDbTtl | func flattenDynamoDbTtl(ttlOutput *dynamodb.DescribeTimeToLiveOutput) []interface{} {
m := map[string]interface{}{
"enabled": false,
}
if ttlOutput == nil || ttlOutput.TimeToLiveDescription == nil {
return []interface{}{m}
}
ttlDesc := ttlOutput.TimeToLiveDescription
m["attribute_name"] = aws.StringValue(t... | go | func flattenDynamoDbTtl(ttlOutput *dynamodb.DescribeTimeToLiveOutput) []interface{} {
m := map[string]interface{}{
"enabled": false,
}
if ttlOutput == nil || ttlOutput.TimeToLiveDescription == nil {
return []interface{}{m}
}
ttlDesc := ttlOutput.TimeToLiveDescription
m["attribute_name"] = aws.StringValue(t... | [
"func",
"flattenDynamoDbTtl",
"(",
"ttlOutput",
"*",
"dynamodb",
".",
"DescribeTimeToLiveOutput",
")",
"[",
"]",
"interface",
"{",
"}",
"{",
"m",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"false",
",",
"}",
"\n\n",
"... | // Expanders + flatteners | [
"Expanders",
"+",
"flatteners"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/structure.go#L4193-L4208 |
126,401 | terraform-providers/terraform-provider-aws | aws/resource_aws_lb.go | flattenSubnetsFromAvailabilityZones | func flattenSubnetsFromAvailabilityZones(availabilityZones []*elbv2.AvailabilityZone) []string {
var result []string
for _, az := range availabilityZones {
result = append(result, aws.StringValue(az.SubnetId))
}
return result
} | go | func flattenSubnetsFromAvailabilityZones(availabilityZones []*elbv2.AvailabilityZone) []string {
var result []string
for _, az := range availabilityZones {
result = append(result, aws.StringValue(az.SubnetId))
}
return result
} | [
"func",
"flattenSubnetsFromAvailabilityZones",
"(",
"availabilityZones",
"[",
"]",
"*",
"elbv2",
".",
"AvailabilityZone",
")",
"[",
"]",
"string",
"{",
"var",
"result",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"az",
":=",
"range",
"availabilityZones",
"{",
... | // flattenSubnetsFromAvailabilityZones creates a slice of strings containing the subnet IDs
// for the ALB based on the AvailabilityZones structure returned by the API. | [
"flattenSubnetsFromAvailabilityZones",
"creates",
"a",
"slice",
"of",
"strings",
"containing",
"the",
"subnet",
"IDs",
"for",
"the",
"ALB",
"based",
"on",
"the",
"AvailabilityZones",
"structure",
"returned",
"by",
"the",
"API",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_lb.go#L629-L635 |
126,402 | terraform-providers/terraform-provider-aws | aws/resource_aws_lb.go | customizeDiffNLBSubnets | func customizeDiffNLBSubnets(diff *schema.ResourceDiff, v interface{}) error {
// The current criteria for determining if the operation should be ForceNew:
// - lb of type "network"
// - existing resource (id is not "")
// - there are actual changes to be made in the subnets
//
// Any other combination should be ... | go | func customizeDiffNLBSubnets(diff *schema.ResourceDiff, v interface{}) error {
// The current criteria for determining if the operation should be ForceNew:
// - lb of type "network"
// - existing resource (id is not "")
// - there are actual changes to be made in the subnets
//
// Any other combination should be ... | [
"func",
"customizeDiffNLBSubnets",
"(",
"diff",
"*",
"schema",
".",
"ResourceDiff",
",",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"// The current criteria for determining if the operation should be ForceNew:",
"// - lb of type \"network\"",
"// - existing resource (id is no... | // Load balancers of type 'network' cannot have their subnets updated at
// this time. If the type is 'network' and subnets have changed, mark the
// diff as a ForceNew operation | [
"Load",
"balancers",
"of",
"type",
"network",
"cannot",
"have",
"their",
"subnets",
"updated",
"at",
"this",
"time",
".",
"If",
"the",
"type",
"is",
"network",
"and",
"subnets",
"have",
"changed",
"mark",
"the",
"diff",
"as",
"a",
"ForceNew",
"operation"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_lb.go#L758-L798 |
126,403 | terraform-providers/terraform-provider-aws | aws/data_source_aws_ami.go | amiBlockDeviceMappings | func amiBlockDeviceMappings(m []*ec2.BlockDeviceMapping) *schema.Set {
s := &schema.Set{
F: amiBlockDeviceMappingHash,
}
for _, v := range m {
mapping := map[string]interface{}{
"device_name": aws.StringValue(v.DeviceName),
"virtual_name": aws.StringValue(v.VirtualName),
}
if v.Ebs != nil {
ebs :=... | go | func amiBlockDeviceMappings(m []*ec2.BlockDeviceMapping) *schema.Set {
s := &schema.Set{
F: amiBlockDeviceMappingHash,
}
for _, v := range m {
mapping := map[string]interface{}{
"device_name": aws.StringValue(v.DeviceName),
"virtual_name": aws.StringValue(v.VirtualName),
}
if v.Ebs != nil {
ebs :=... | [
"func",
"amiBlockDeviceMappings",
"(",
"m",
"[",
"]",
"*",
"ec2",
".",
"BlockDeviceMapping",
")",
"*",
"schema",
".",
"Set",
"{",
"s",
":=",
"&",
"schema",
".",
"Set",
"{",
"F",
":",
"amiBlockDeviceMappingHash",
",",
"}",
"\n",
"for",
"_",
",",
"v",
... | // Returns a set of block device mappings. | [
"Returns",
"a",
"set",
"of",
"block",
"device",
"mappings",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/data_source_aws_ami.go#L300-L327 |
126,404 | terraform-providers/terraform-provider-aws | aws/data_source_aws_ami.go | amiProductCodes | func amiProductCodes(m []*ec2.ProductCode) *schema.Set {
s := &schema.Set{
F: amiProductCodesHash,
}
for _, v := range m {
code := map[string]interface{}{
"product_code_id": aws.StringValue(v.ProductCodeId),
"product_code_type": aws.StringValue(v.ProductCodeType),
}
s.Add(code)
}
return s
} | go | func amiProductCodes(m []*ec2.ProductCode) *schema.Set {
s := &schema.Set{
F: amiProductCodesHash,
}
for _, v := range m {
code := map[string]interface{}{
"product_code_id": aws.StringValue(v.ProductCodeId),
"product_code_type": aws.StringValue(v.ProductCodeType),
}
s.Add(code)
}
return s
} | [
"func",
"amiProductCodes",
"(",
"m",
"[",
"]",
"*",
"ec2",
".",
"ProductCode",
")",
"*",
"schema",
".",
"Set",
"{",
"s",
":=",
"&",
"schema",
".",
"Set",
"{",
"F",
":",
"amiProductCodesHash",
",",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"... | // Returns a set of product codes. | [
"Returns",
"a",
"set",
"of",
"product",
"codes",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/data_source_aws_ami.go#L330-L342 |
126,405 | terraform-providers/terraform-provider-aws | aws/data_source_aws_ami.go | amiRootSnapshotId | func amiRootSnapshotId(image *ec2.Image) string {
if image.RootDeviceName == nil {
return ""
}
for _, bdm := range image.BlockDeviceMappings {
if bdm.DeviceName == nil || *bdm.DeviceName != *image.RootDeviceName {
continue
}
if bdm.Ebs != nil && bdm.Ebs.SnapshotId != nil {
return *bdm.Ebs.SnapshotId
... | go | func amiRootSnapshotId(image *ec2.Image) string {
if image.RootDeviceName == nil {
return ""
}
for _, bdm := range image.BlockDeviceMappings {
if bdm.DeviceName == nil || *bdm.DeviceName != *image.RootDeviceName {
continue
}
if bdm.Ebs != nil && bdm.Ebs.SnapshotId != nil {
return *bdm.Ebs.SnapshotId
... | [
"func",
"amiRootSnapshotId",
"(",
"image",
"*",
"ec2",
".",
"Image",
")",
"string",
"{",
"if",
"image",
".",
"RootDeviceName",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"for",
"_",
",",
"bdm",
":=",
"range",
"image",
".",
"BlockDeviceMap... | // Returns the root snapshot ID for an image, if it has one | [
"Returns",
"the",
"root",
"snapshot",
"ID",
"for",
"an",
"image",
"if",
"it",
"has",
"one"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/data_source_aws_ami.go#L345-L358 |
126,406 | terraform-providers/terraform-provider-aws | aws/data_source_aws_ami.go | amiStateReason | func amiStateReason(m *ec2.StateReason) map[string]interface{} {
s := make(map[string]interface{})
if m != nil {
s["code"] = aws.StringValue(m.Code)
s["message"] = aws.StringValue(m.Message)
} else {
s["code"] = "UNSET"
s["message"] = "UNSET"
}
return s
} | go | func amiStateReason(m *ec2.StateReason) map[string]interface{} {
s := make(map[string]interface{})
if m != nil {
s["code"] = aws.StringValue(m.Code)
s["message"] = aws.StringValue(m.Message)
} else {
s["code"] = "UNSET"
s["message"] = "UNSET"
}
return s
} | [
"func",
"amiStateReason",
"(",
"m",
"*",
"ec2",
".",
"StateReason",
")",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"s",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"m",
"!=",
"nil",
"{",
"s",... | // Returns the state reason. | [
"Returns",
"the",
"state",
"reason",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/data_source_aws_ami.go#L361-L371 |
126,407 | terraform-providers/terraform-provider-aws | aws/data_source_aws_ami.go | amiBlockDeviceMappingHash | func amiBlockDeviceMappingHash(v interface{}) int {
var buf bytes.Buffer
// All keys added in alphabetical order.
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string)))
if d, ok := m["ebs"]; ok {
if len(d.(map[string]interface{})) > 0 {
e := d.(map[string]interface{})
... | go | func amiBlockDeviceMappingHash(v interface{}) int {
var buf bytes.Buffer
// All keys added in alphabetical order.
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string)))
if d, ok := m["ebs"]; ok {
if len(d.(map[string]interface{})) > 0 {
e := d.(map[string]interface{})
... | [
"func",
"amiBlockDeviceMappingHash",
"(",
"v",
"interface",
"{",
"}",
")",
"int",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"// All keys added in alphabetical order.",
"m",
":=",
"v",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
... | // Generates a hash for the set hash function used by the block_device_mappings
// attribute. | [
"Generates",
"a",
"hash",
"for",
"the",
"set",
"hash",
"function",
"used",
"by",
"the",
"block_device_mappings",
"attribute",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/data_source_aws_ami.go#L375-L400 |
126,408 | terraform-providers/terraform-provider-aws | aws/resource_aws_route53_record.go | findRecord | func findRecord(d *schema.ResourceData, meta interface{}) (*route53.ResourceRecordSet, error) {
conn := meta.(*AWSClient).r53conn
// Scan for a
zone := cleanZoneID(d.Get("zone_id").(string))
// get expanded name
zoneRecord, err := conn.GetHostedZone(&route53.GetHostedZoneInput{Id: aws.String(zone)})
if err != ni... | go | func findRecord(d *schema.ResourceData, meta interface{}) (*route53.ResourceRecordSet, error) {
conn := meta.(*AWSClient).r53conn
// Scan for a
zone := cleanZoneID(d.Get("zone_id").(string))
// get expanded name
zoneRecord, err := conn.GetHostedZone(&route53.GetHostedZoneInput{Id: aws.String(zone)})
if err != ni... | [
"func",
"findRecord",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
")",
"(",
"*",
"route53",
".",
"ResourceRecordSet",
",",
"error",
")",
"{",
"conn",
":=",
"meta",
".",
"(",
"*",
"AWSClient",
")",
".",
"r53conn",
... | // findRecord takes a ResourceData struct for aws_resource_route53_record. It
// uses the referenced zone_id to query Route53 and find information on it's
// records.
//
// If records are found, it returns the matching
// route53.ResourceRecordSet and nil for the error.
//
// If no hosted zone is found, it returns a ni... | [
"findRecord",
"takes",
"a",
"ResourceData",
"struct",
"for",
"aws_resource_route53_record",
".",
"It",
"uses",
"the",
"referenced",
"zone_id",
"to",
"query",
"Route53",
"and",
"find",
"information",
"on",
"it",
"s",
"records",
".",
"If",
"records",
"are",
"found... | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_route53_record.go#L607-L696 |
126,409 | terraform-providers/terraform-provider-aws | aws/resource_aws_route53_record.go | expandRecordName | func expandRecordName(name, zone string) string {
rn := strings.ToLower(strings.TrimSuffix(name, "."))
zone = strings.TrimSuffix(zone, ".")
if !strings.HasSuffix(rn, zone) {
if len(name) == 0 {
rn = zone
} else {
rn = strings.Join([]string{rn, zone}, ".")
}
}
return rn
} | go | func expandRecordName(name, zone string) string {
rn := strings.ToLower(strings.TrimSuffix(name, "."))
zone = strings.TrimSuffix(zone, ".")
if !strings.HasSuffix(rn, zone) {
if len(name) == 0 {
rn = zone
} else {
rn = strings.Join([]string{rn, zone}, ".")
}
}
return rn
} | [
"func",
"expandRecordName",
"(",
"name",
",",
"zone",
"string",
")",
"string",
"{",
"rn",
":=",
"strings",
".",
"ToLower",
"(",
"strings",
".",
"TrimSuffix",
"(",
"name",
",",
"\"",
"\"",
")",
")",
"\n",
"zone",
"=",
"strings",
".",
"TrimSuffix",
"(",
... | // Check if the current record name contains the zone suffix.
// If it does not, add the zone name to form a fully qualified name
// and keep AWS happy. | [
"Check",
"if",
"the",
"current",
"record",
"name",
"contains",
"the",
"zone",
"suffix",
".",
"If",
"it",
"does",
"not",
"add",
"the",
"zone",
"name",
"to",
"form",
"a",
"fully",
"qualified",
"name",
"and",
"keep",
"AWS",
"happy",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_route53_record.go#L922-L933 |
126,410 | terraform-providers/terraform-provider-aws | aws/resource_aws_lb_target_group_attachment.go | resourceAwsLbAttachmentRead | func resourceAwsLbAttachmentRead(d *schema.ResourceData, meta interface{}) error {
elbconn := meta.(*AWSClient).elbv2conn
target := &elbv2.TargetDescription{
Id: aws.String(d.Get("target_id").(string)),
}
if v, ok := d.GetOk("port"); ok {
target.Port = aws.Int64(int64(v.(int)))
}
if v, ok := d.GetOk("avail... | go | func resourceAwsLbAttachmentRead(d *schema.ResourceData, meta interface{}) error {
elbconn := meta.(*AWSClient).elbv2conn
target := &elbv2.TargetDescription{
Id: aws.String(d.Get("target_id").(string)),
}
if v, ok := d.GetOk("port"); ok {
target.Port = aws.Int64(int64(v.(int)))
}
if v, ok := d.GetOk("avail... | [
"func",
"resourceAwsLbAttachmentRead",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
")",
"error",
"{",
"elbconn",
":=",
"meta",
".",
"(",
"*",
"AWSClient",
")",
".",
"elbv2conn",
"\n\n",
"target",
":=",
"&",
"elbv2",
... | // resourceAwsLbAttachmentRead requires all of the fields in order to describe the correct
// target, so there is no work to do beyond ensuring that the target and group still exist. | [
"resourceAwsLbAttachmentRead",
"requires",
"all",
"of",
"the",
"fields",
"in",
"order",
"to",
"describe",
"the",
"correct",
"target",
"so",
"there",
"is",
"no",
"work",
"to",
"do",
"beyond",
"ensuring",
"that",
"the",
"target",
"and",
"group",
"still",
"exist"... | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_lb_target_group_attachment.go#L110-L150 |
126,411 | terraform-providers/terraform-provider-aws | aws/network_acl_entry.go | validatePorts | func validatePorts(to int64, from int64, expected expectedPortPair) bool {
if to != expected.to_port || from != expected.from_port {
return false
}
return true
} | go | func validatePorts(to int64, from int64, expected expectedPortPair) bool {
if to != expected.to_port || from != expected.from_port {
return false
}
return true
} | [
"func",
"validatePorts",
"(",
"to",
"int64",
",",
"from",
"int64",
",",
"expected",
"expectedPortPair",
")",
"bool",
"{",
"if",
"to",
"!=",
"expected",
".",
"to_port",
"||",
"from",
"!=",
"expected",
".",
"from_port",
"{",
"return",
"false",
"\n",
"}",
"... | // validatePorts ensures the ports and protocol match expected
// values. | [
"validatePorts",
"ensures",
"the",
"ports",
"and",
"protocol",
"match",
"expected",
"values",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/network_acl_entry.go#L229-L235 |
126,412 | terraform-providers/terraform-provider-aws | aws/network_acl_entry.go | validateCIDRBlock | func validateCIDRBlock(cidr string) error {
_, ipnet, err := net.ParseCIDR(cidr)
if err != nil {
return err
}
if ipnet.String() != cidr {
return fmt.Errorf("%s is not a valid mask; did you mean %s?", cidr, ipnet)
}
return nil
} | go | func validateCIDRBlock(cidr string) error {
_, ipnet, err := net.ParseCIDR(cidr)
if err != nil {
return err
}
if ipnet.String() != cidr {
return fmt.Errorf("%s is not a valid mask; did you mean %s?", cidr, ipnet)
}
return nil
} | [
"func",
"validateCIDRBlock",
"(",
"cidr",
"string",
")",
"error",
"{",
"_",
",",
"ipnet",
",",
"err",
":=",
"net",
".",
"ParseCIDR",
"(",
"cidr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"ipnet",
".",
"Strin... | // validateCIDRBlock ensures the passed CIDR block represents an implied
// network, and not an overly-specified IP address. | [
"validateCIDRBlock",
"ensures",
"the",
"passed",
"CIDR",
"block",
"represents",
"an",
"implied",
"network",
"and",
"not",
"an",
"overly",
"-",
"specified",
"IP",
"address",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/network_acl_entry.go#L239-L249 |
126,413 | terraform-providers/terraform-provider-aws | aws/data_source_aws_route53_zone.go | hostedZoneNameServers | func hostedZoneNameServers(id string, conn *route53.Route53) ([]string, error) {
req := &route53.GetHostedZoneInput{}
req.Id = aws.String(id)
resp, err := conn.GetHostedZone(req)
if err != nil {
return []string{}, err
}
if resp.DelegationSet == nil {
return []string{}, nil
}
servers := []string{}
for _,... | go | func hostedZoneNameServers(id string, conn *route53.Route53) ([]string, error) {
req := &route53.GetHostedZoneInput{}
req.Id = aws.String(id)
resp, err := conn.GetHostedZone(req)
if err != nil {
return []string{}, err
}
if resp.DelegationSet == nil {
return []string{}, nil
}
servers := []string{}
for _,... | [
"func",
"hostedZoneNameServers",
"(",
"id",
"string",
",",
"conn",
"*",
"route53",
".",
"Route53",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"req",
":=",
"&",
"route53",
".",
"GetHostedZoneInput",
"{",
"}",
"\n",
"req",
".",
"Id",
"=",
"a... | // used to retrieve name servers | [
"used",
"to",
"retrieve",
"name",
"servers"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/data_source_aws_route53_zone.go#L192-L212 |
126,414 | terraform-providers/terraform-provider-aws | aws/tagsRAM.go | tagsFromMapRAM | func tagsFromMapRAM(m map[string]interface{}) []*ram.Tag {
result := make([]*ram.Tag, 0, len(m))
for k, v := range m {
t := &ram.Tag{
Key: aws.String(k),
Value: aws.String(v.(string)),
}
if !tagIgnoredRAM(t) {
result = append(result, t)
}
}
return result
} | go | func tagsFromMapRAM(m map[string]interface{}) []*ram.Tag {
result := make([]*ram.Tag, 0, len(m))
for k, v := range m {
t := &ram.Tag{
Key: aws.String(k),
Value: aws.String(v.(string)),
}
if !tagIgnoredRAM(t) {
result = append(result, t)
}
}
return result
} | [
"func",
"tagsFromMapRAM",
"(",
"m",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"[",
"]",
"*",
"ram",
".",
"Tag",
"{",
"result",
":=",
"make",
"(",
"[",
"]",
"*",
"ram",
".",
"Tag",
",",
"0",
",",
"len",
"(",
"m",
")",
")",
"\n",
... | // tagsFromMapRAM returns the tags for the given map of data for RAM. | [
"tagsFromMapRAM",
"returns",
"the",
"tags",
"for",
"the",
"given",
"map",
"of",
"data",
"for",
"RAM",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tagsRAM.go#L37-L50 |
126,415 | terraform-providers/terraform-provider-aws | aws/tagsRAM.go | tagsToMapRAM | func tagsToMapRAM(ts []*ram.Tag) map[string]string {
result := make(map[string]string)
for _, t := range ts {
if !tagIgnoredRAM(t) {
result[aws.StringValue(t.Key)] = aws.StringValue(t.Value)
}
}
return result
} | go | func tagsToMapRAM(ts []*ram.Tag) map[string]string {
result := make(map[string]string)
for _, t := range ts {
if !tagIgnoredRAM(t) {
result[aws.StringValue(t.Key)] = aws.StringValue(t.Value)
}
}
return result
} | [
"func",
"tagsToMapRAM",
"(",
"ts",
"[",
"]",
"*",
"ram",
".",
"Tag",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"result",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"t",
":=",
"range",
"ts",
"{",
"if... | // tagsToMapRAM turns the list of RAM tags into a map. | [
"tagsToMapRAM",
"turns",
"the",
"list",
"of",
"RAM",
"tags",
"into",
"a",
"map",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tagsRAM.go#L53-L62 |
126,416 | terraform-providers/terraform-provider-aws | aws/tagsRAM.go | tagKeysRam | func tagKeysRam(ts []*ram.Tag) []*string {
result := make([]*string, 0, len(ts))
for _, t := range ts {
result = append(result, t.Key)
}
return result
} | go | func tagKeysRam(ts []*ram.Tag) []*string {
result := make([]*string, 0, len(ts))
for _, t := range ts {
result = append(result, t.Key)
}
return result
} | [
"func",
"tagKeysRam",
"(",
"ts",
"[",
"]",
"*",
"ram",
".",
"Tag",
")",
"[",
"]",
"*",
"string",
"{",
"result",
":=",
"make",
"(",
"[",
"]",
"*",
"string",
",",
"0",
",",
"len",
"(",
"ts",
")",
")",
"\n",
"for",
"_",
",",
"t",
":=",
"range"... | // tagKeysRam returns the keys for the list of RAM tags | [
"tagKeysRam",
"returns",
"the",
"keys",
"for",
"the",
"list",
"of",
"RAM",
"tags"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tagsRAM.go#L79-L85 |
126,417 | terraform-providers/terraform-provider-aws | aws/resource_aws_iam_policy.go | iamPolicyPruneVersions | func iamPolicyPruneVersions(arn string, iamconn *iam.IAM) error {
versions, err := iamPolicyListVersions(arn, iamconn)
if err != nil {
return err
}
if len(versions) < 5 {
return nil
}
var oldestVersion *iam.PolicyVersion
for _, version := range versions {
if *version.IsDefaultVersion {
continue
}
... | go | func iamPolicyPruneVersions(arn string, iamconn *iam.IAM) error {
versions, err := iamPolicyListVersions(arn, iamconn)
if err != nil {
return err
}
if len(versions) < 5 {
return nil
}
var oldestVersion *iam.PolicyVersion
for _, version := range versions {
if *version.IsDefaultVersion {
continue
}
... | [
"func",
"iamPolicyPruneVersions",
"(",
"arn",
"string",
",",
"iamconn",
"*",
"iam",
".",
"IAM",
")",
"error",
"{",
"versions",
",",
"err",
":=",
"iamPolicyListVersions",
"(",
"arn",
",",
"iamconn",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err... | // iamPolicyPruneVersions deletes the oldest versions.
//
// Old versions are deleted until there are 4 or less remaining, which means at
// least one more can be created before hitting the maximum of 5.
//
// The default version is never deleted. | [
"iamPolicyPruneVersions",
"deletes",
"the",
"oldest",
"versions",
".",
"Old",
"versions",
"are",
"deleted",
"until",
"there",
"are",
"4",
"or",
"less",
"remaining",
"which",
"means",
"at",
"least",
"one",
"more",
"can",
"be",
"created",
"before",
"hitting",
"t... | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_iam_policy.go#L263-L286 |
126,418 | terraform-providers/terraform-provider-aws | aws/resource_aws_lambda_function.go | loadFileContent | func loadFileContent(v string) ([]byte, error) {
filename, err := homedir.Expand(v)
if err != nil {
return nil, err
}
fileContent, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
return fileContent, nil
} | go | func loadFileContent(v string) ([]byte, error) {
filename, err := homedir.Expand(v)
if err != nil {
return nil, err
}
fileContent, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
return fileContent, nil
} | [
"func",
"loadFileContent",
"(",
"v",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"filename",
",",
"err",
":=",
"homedir",
".",
"Expand",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",... | // loadFileContent returns contents of a file in a given path | [
"loadFileContent",
"returns",
"contents",
"of",
"a",
"file",
"in",
"a",
"given",
"path"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_lambda_function.go#L893-L903 |
126,419 | terraform-providers/terraform-provider-aws | aws/data_source_aws_autoscaling_group.go | groupDescriptionAttributes | func groupDescriptionAttributes(d *schema.ResourceData, group *autoscaling.Group) error {
log.Printf("[DEBUG] Setting attributes: %s", group)
d.Set("name", group.AutoScalingGroupName)
d.Set("arn", group.AutoScalingGroupARN)
if err := d.Set("availability_zones", aws.StringValueSlice(group.AvailabilityZones)); err !=... | go | func groupDescriptionAttributes(d *schema.ResourceData, group *autoscaling.Group) error {
log.Printf("[DEBUG] Setting attributes: %s", group)
d.Set("name", group.AutoScalingGroupName)
d.Set("arn", group.AutoScalingGroupARN)
if err := d.Set("availability_zones", aws.StringValueSlice(group.AvailabilityZones)); err !=... | [
"func",
"groupDescriptionAttributes",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"group",
"*",
"autoscaling",
".",
"Group",
")",
"error",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"group",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
"... | // Populate group attribute fields with the returned group | [
"Populate",
"group",
"attribute",
"fields",
"with",
"the",
"returned",
"group"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/data_source_aws_autoscaling_group.go#L151-L181 |
126,420 | terraform-providers/terraform-provider-aws | aws/hosted_zones.go | HostedZoneIDForRegion | func HostedZoneIDForRegion(region string) (string, error) {
if v, ok := hostedZoneIDsMap[region]; ok {
return v, nil
}
return "", fmt.Errorf("S3 hosted zone ID not found for region: %s", region)
} | go | func HostedZoneIDForRegion(region string) (string, error) {
if v, ok := hostedZoneIDsMap[region]; ok {
return v, nil
}
return "", fmt.Errorf("S3 hosted zone ID not found for region: %s", region)
} | [
"func",
"HostedZoneIDForRegion",
"(",
"region",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"v",
",",
"ok",
":=",
"hostedZoneIDsMap",
"[",
"region",
"]",
";",
"ok",
"{",
"return",
"v",
",",
"nil",
"\n",
"}",
"\n",
"return",
"\"",
"\""... | // Returns the hosted zone ID for an S3 website endpoint region. This can be
// used as input to the aws_route53_record resource's zone_id argument. | [
"Returns",
"the",
"hosted",
"zone",
"ID",
"for",
"an",
"S3",
"website",
"endpoint",
"region",
".",
"This",
"can",
"be",
"used",
"as",
"input",
"to",
"the",
"aws_route53_record",
"resource",
"s",
"zone_id",
"argument",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/hosted_zones.go#L33-L38 |
126,421 | terraform-providers/terraform-provider-aws | aws/resource_aws_iam_user_login_profile.go | generateIAMPassword | func generateIAMPassword(length int) string {
const charset = charLower + charUpper + charNumbers + charSymbols
result := make([]byte, length)
charsetSize := big.NewInt(int64(len(charset)))
// rather than trying to artificially add specific characters from each
// class to the password to match the policy, we ge... | go | func generateIAMPassword(length int) string {
const charset = charLower + charUpper + charNumbers + charSymbols
result := make([]byte, length)
charsetSize := big.NewInt(int64(len(charset)))
// rather than trying to artificially add specific characters from each
// class to the password to match the policy, we ge... | [
"func",
"generateIAMPassword",
"(",
"length",
"int",
")",
"string",
"{",
"const",
"charset",
"=",
"charLower",
"+",
"charUpper",
"+",
"charNumbers",
"+",
"charSymbols",
"\n\n",
"result",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"length",
")",
"\n",
"chars... | // generateIAMPassword generates a random password of a given length, matching the
// most restrictive iam password policy. | [
"generateIAMPassword",
"generates",
"a",
"random",
"password",
"of",
"a",
"given",
"length",
"matching",
"the",
"most",
"restrictive",
"iam",
"password",
"policy",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_iam_user_login_profile.go#L79-L113 |
126,422 | terraform-providers/terraform-provider-aws | aws/resource_aws_iam_user_login_profile.go | checkIAMPwdPolicy | func checkIAMPwdPolicy(pass []byte) bool {
return (bytes.ContainsAny(pass, charLower) &&
bytes.ContainsAny(pass, charNumbers) &&
bytes.ContainsAny(pass, charSymbols) &&
bytes.ContainsAny(pass, charUpper))
} | go | func checkIAMPwdPolicy(pass []byte) bool {
return (bytes.ContainsAny(pass, charLower) &&
bytes.ContainsAny(pass, charNumbers) &&
bytes.ContainsAny(pass, charSymbols) &&
bytes.ContainsAny(pass, charUpper))
} | [
"func",
"checkIAMPwdPolicy",
"(",
"pass",
"[",
"]",
"byte",
")",
"bool",
"{",
"return",
"(",
"bytes",
".",
"ContainsAny",
"(",
"pass",
",",
"charLower",
")",
"&&",
"bytes",
".",
"ContainsAny",
"(",
"pass",
",",
"charNumbers",
")",
"&&",
"bytes",
".",
"... | // Check the generated password contains all character classes listed in the
// IAM password policy. | [
"Check",
"the",
"generated",
"password",
"contains",
"all",
"character",
"classes",
"listed",
"in",
"the",
"IAM",
"password",
"policy",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_iam_user_login_profile.go#L117-L122 |
126,423 | terraform-providers/terraform-provider-aws | aws/resource_aws_autoscaling_group_waiting.go | capacitySatisfiedCreate | func capacitySatisfiedCreate(d *schema.ResourceData, haveASG, haveELB int) (bool, string) {
minASG := d.Get("min_size").(int)
if wantASG := d.Get("desired_capacity").(int); wantASG > 0 {
minASG = wantASG
}
if haveASG < minASG {
return false, fmt.Sprintf(
"Need at least %d healthy instances in ASG, have %d", ... | go | func capacitySatisfiedCreate(d *schema.ResourceData, haveASG, haveELB int) (bool, string) {
minASG := d.Get("min_size").(int)
if wantASG := d.Get("desired_capacity").(int); wantASG > 0 {
minASG = wantASG
}
if haveASG < minASG {
return false, fmt.Sprintf(
"Need at least %d healthy instances in ASG, have %d", ... | [
"func",
"capacitySatisfiedCreate",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"haveASG",
",",
"haveELB",
"int",
")",
"(",
"bool",
",",
"string",
")",
"{",
"minASG",
":=",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
"\n",
"i... | // capacitySatisfiedCreate treats all targets as minimums | [
"capacitySatisfiedCreate",
"treats",
"all",
"targets",
"as",
"minimums"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_autoscaling_group_waiting.go#L132-L150 |
126,424 | terraform-providers/terraform-provider-aws | aws/resource_aws_autoscaling_group_waiting.go | capacitySatisfiedUpdate | func capacitySatisfiedUpdate(d *schema.ResourceData, haveASG, haveELB int) (bool, string) {
if wantASG := d.Get("desired_capacity").(int); wantASG > 0 {
if haveASG != wantASG {
return false, fmt.Sprintf(
"Need exactly %d healthy instances in ASG, have %d", wantASG, haveASG)
}
}
if wantELB := d.Get("wait_f... | go | func capacitySatisfiedUpdate(d *schema.ResourceData, haveASG, haveELB int) (bool, string) {
if wantASG := d.Get("desired_capacity").(int); wantASG > 0 {
if haveASG != wantASG {
return false, fmt.Sprintf(
"Need exactly %d healthy instances in ASG, have %d", wantASG, haveASG)
}
}
if wantELB := d.Get("wait_f... | [
"func",
"capacitySatisfiedUpdate",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"haveASG",
",",
"haveELB",
"int",
")",
"(",
"bool",
",",
"string",
")",
"{",
"if",
"wantASG",
":=",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
"... | // capacitySatisfiedUpdate only cares about specific targets | [
"capacitySatisfiedUpdate",
"only",
"cares",
"about",
"specific",
"targets"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_autoscaling_group_waiting.go#L153-L167 |
126,425 | terraform-providers/terraform-provider-aws | aws/data_source_aws_instance.go | dataSourceAwsInstanceRead | func dataSourceAwsInstanceRead(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn
filters, filtersOk := d.GetOk("filter")
instanceID, instanceIDOk := d.GetOk("instance_id")
tags, tagsOk := d.GetOk("instance_tags")
if !filtersOk && !instanceIDOk && !tagsOk {
return fmt.Errorf("O... | go | func dataSourceAwsInstanceRead(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn
filters, filtersOk := d.GetOk("filter")
instanceID, instanceIDOk := d.GetOk("instance_id")
tags, tagsOk := d.GetOk("instance_tags")
if !filtersOk && !instanceIDOk && !tagsOk {
return fmt.Errorf("O... | [
"func",
"dataSourceAwsInstanceRead",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
")",
"error",
"{",
"conn",
":=",
"meta",
".",
"(",
"*",
"AWSClient",
")",
".",
"ec2conn",
"\n\n",
"filters",
",",
"filtersOk",
":=",
"d... | // dataSourceAwsInstanceRead performs the instanceID lookup | [
"dataSourceAwsInstanceRead",
"performs",
"the",
"instanceID",
"lookup"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/data_source_aws_instance.go#L265-L350 |
126,426 | terraform-providers/terraform-provider-aws | aws/resource_aws_docdb_cluster_instance.go | resourceAwsDocDBInstanceRetrieve | func resourceAwsDocDBInstanceRetrieve(id string, conn *docdb.DocDB) (*docdb.DBInstance, error) {
opts := docdb.DescribeDBInstancesInput{
DBInstanceIdentifier: aws.String(id),
}
log.Printf("[DEBUG] DocDB Instance describe configuration: %#v", opts)
resp, err := conn.DescribeDBInstances(&opts)
if err != nil {
... | go | func resourceAwsDocDBInstanceRetrieve(id string, conn *docdb.DocDB) (*docdb.DBInstance, error) {
opts := docdb.DescribeDBInstancesInput{
DBInstanceIdentifier: aws.String(id),
}
log.Printf("[DEBUG] DocDB Instance describe configuration: %#v", opts)
resp, err := conn.DescribeDBInstances(&opts)
if err != nil {
... | [
"func",
"resourceAwsDocDBInstanceRetrieve",
"(",
"id",
"string",
",",
"conn",
"*",
"docdb",
".",
"DocDB",
")",
"(",
"*",
"docdb",
".",
"DBInstance",
",",
"error",
")",
"{",
"opts",
":=",
"docdb",
".",
"DescribeDBInstancesInput",
"{",
"DBInstanceIdentifier",
":... | // resourceAwsDocDBInstanceRetrieve fetches DBInstance information from the AWS
// API. It returns an error if there is a communication problem or unexpected
// error with AWS. When the DBInstance is not found, it returns no error and a
// nil pointer. | [
"resourceAwsDocDBInstanceRetrieve",
"fetches",
"DBInstance",
"information",
"from",
"the",
"AWS",
"API",
".",
"It",
"returns",
"an",
"error",
"if",
"there",
"is",
"a",
"communication",
"problem",
"or",
"unexpected",
"error",
"with",
"AWS",
".",
"When",
"the",
"D... | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_docdb_cluster_instance.go#L444-L464 |
126,427 | terraform-providers/terraform-provider-aws | aws/import_aws_dx_gateway.go | resourceAwsDxGatewayImportState | func resourceAwsDxGatewayImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
conn := meta.(*AWSClient).dxconn
id := d.Id()
resp, err := conn.DescribeDirectConnectGateways(&directconnect.DescribeDirectConnectGatewaysInput{
DirectConnectGatewayId: aws.String(id),
})
if err != n... | go | func resourceAwsDxGatewayImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
conn := meta.(*AWSClient).dxconn
id := d.Id()
resp, err := conn.DescribeDirectConnectGateways(&directconnect.DescribeDirectConnectGatewaysInput{
DirectConnectGatewayId: aws.String(id),
})
if err != n... | [
"func",
"resourceAwsDxGatewayImportState",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
")",
"(",
"[",
"]",
"*",
"schema",
".",
"ResourceData",
",",
"error",
")",
"{",
"conn",
":=",
"meta",
".",
"(",
"*",
"AWSClient",... | // Direct Connect Gateway import also imports all assocations | [
"Direct",
"Connect",
"Gateway",
"import",
"also",
"imports",
"all",
"assocations"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/import_aws_dx_gateway.go#L12-L48 |
126,428 | terraform-providers/terraform-provider-aws | aws/import_aws_security_group.go | resourceAwsSecurityGroupImportState | func resourceAwsSecurityGroupImportState(
d *schema.ResourceData,
meta interface{}) ([]*schema.ResourceData, error) {
conn := meta.(*AWSClient).ec2conn
// First query the security group
sgRaw, _, err := SGStateRefreshFunc(conn, d.Id())()
if err != nil {
return nil, err
}
if sgRaw == nil {
return nil, fmt.E... | go | func resourceAwsSecurityGroupImportState(
d *schema.ResourceData,
meta interface{}) ([]*schema.ResourceData, error) {
conn := meta.(*AWSClient).ec2conn
// First query the security group
sgRaw, _, err := SGStateRefreshFunc(conn, d.Id())()
if err != nil {
return nil, err
}
if sgRaw == nil {
return nil, fmt.E... | [
"func",
"resourceAwsSecurityGroupImportState",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
")",
"(",
"[",
"]",
"*",
"schema",
".",
"ResourceData",
",",
"error",
")",
"{",
"conn",
":=",
"meta",
".",
"(",
"*",
"AWSClie... | // Security group import fans out to multiple resources due to the
// security group rules. Instead of creating one resource with nested
// rules, we use the best practices approach of one resource per rule. | [
"Security",
"group",
"import",
"fans",
"out",
"to",
"multiple",
"resources",
"due",
"to",
"the",
"security",
"group",
"rules",
".",
"Instead",
"of",
"creating",
"one",
"resource",
"with",
"nested",
"rules",
"we",
"use",
"the",
"best",
"practices",
"approach",
... | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/import_aws_security_group.go#L13-L49 |
126,429 | terraform-providers/terraform-provider-aws | aws/resource_aws_nat_gateway.go | NGStateRefreshFunc | func NGStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
opts := &ec2.DescribeNatGatewaysInput{
NatGatewayIds: []*string{aws.String(id)},
}
resp, err := conn.DescribeNatGateways(opts)
if err != nil {
if ec2err, ok := err.(awserr.Error); ok... | go | func NGStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
opts := &ec2.DescribeNatGatewaysInput{
NatGatewayIds: []*string{aws.String(id)},
}
resp, err := conn.DescribeNatGateways(opts)
if err != nil {
if ec2err, ok := err.(awserr.Error); ok... | [
"func",
"NGStateRefreshFunc",
"(",
"conn",
"*",
"ec2",
".",
"EC2",
",",
"id",
"string",
")",
"resource",
".",
"StateRefreshFunc",
"{",
"return",
"func",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"string",
",",
"error",
")",
"{",
"opts",
":=",
"&",
"... | // NGStateRefreshFunc returns a resource.StateRefreshFunc that is used to watch
// a NAT Gateway. | [
"NGStateRefreshFunc",
"returns",
"a",
"resource",
".",
"StateRefreshFunc",
"that",
"is",
"used",
"to",
"watch",
"a",
"NAT",
"Gateway",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_nat_gateway.go#L189-L213 |
126,430 | terraform-providers/terraform-provider-aws | aws/autoscaling_tags.go | autoscalingTagSchema | func autoscalingTagSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"key": {
Type: schema.TypeString,
Required: true,
},
"value": {
Type: schema.TypeString,
Required: t... | go | func autoscalingTagSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"key": {
Type: schema.TypeString,
Required: true,
},
"value": {
Type: schema.TypeString,
Required: t... | [
"func",
"autoscalingTagSchema",
"(",
")",
"*",
"schema",
".",
"Schema",
"{",
"return",
"&",
"schema",
".",
"Schema",
"{",
"Type",
":",
"schema",
".",
"TypeSet",
",",
"Optional",
":",
"true",
",",
"Elem",
":",
"&",
"schema",
".",
"Resource",
"{",
"Schem... | // autoscalingTagSchema returns the schema to use for the tag element. | [
"autoscalingTagSchema",
"returns",
"the",
"schema",
"to",
"use",
"for",
"the",
"tag",
"element",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/autoscaling_tags.go#L17-L41 |
126,431 | terraform-providers/terraform-provider-aws | aws/autoscaling_tags.go | setAutoscalingTags | func setAutoscalingTags(conn *autoscaling.AutoScaling, d *schema.ResourceData) error {
resourceID := d.Get("name").(string)
var createTags, removeTags []*autoscaling.Tag
if d.HasChange("tag") || d.HasChange("tags") {
oraw, nraw := d.GetChange("tag")
o := setToMapByKey(oraw.(*schema.Set))
n := setToMapByKey(nr... | go | func setAutoscalingTags(conn *autoscaling.AutoScaling, d *schema.ResourceData) error {
resourceID := d.Get("name").(string)
var createTags, removeTags []*autoscaling.Tag
if d.HasChange("tag") || d.HasChange("tags") {
oraw, nraw := d.GetChange("tag")
o := setToMapByKey(oraw.(*schema.Set))
n := setToMapByKey(nr... | [
"func",
"setAutoscalingTags",
"(",
"conn",
"*",
"autoscaling",
".",
"AutoScaling",
",",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"error",
"{",
"resourceID",
":=",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
"\n",
"var",
"create... | // setTags is a helper to set the tags for a resource. It expects the
// tags field to be named "tag" | [
"setTags",
"is",
"a",
"helper",
"to",
"set",
"the",
"tags",
"for",
"a",
"resource",
".",
"It",
"expects",
"the",
"tags",
"field",
"to",
"be",
"named",
"tag"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/autoscaling_tags.go#L55-L128 |
126,432 | terraform-providers/terraform-provider-aws | aws/autoscaling_tags.go | autoscalingTagDescriptionsToSlice | func autoscalingTagDescriptionsToSlice(ts []*autoscaling.TagDescription) []map[string]interface{} {
tags := make([]map[string]interface{}, 0, len(ts))
for _, t := range ts {
tags = append(tags, map[string]interface{}{
"key": *t.Key,
"value": *t.Value,
"propagate_at_launch": *t... | go | func autoscalingTagDescriptionsToSlice(ts []*autoscaling.TagDescription) []map[string]interface{} {
tags := make([]map[string]interface{}, 0, len(ts))
for _, t := range ts {
tags = append(tags, map[string]interface{}{
"key": *t.Key,
"value": *t.Value,
"propagate_at_launch": *t... | [
"func",
"autoscalingTagDescriptionsToSlice",
"(",
"ts",
"[",
"]",
"*",
"autoscaling",
".",
"TagDescription",
")",
"[",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"tags",
":=",
"make",
"(",
"[",
"]",
"map",
"[",
"string",
"]",
"interface"... | // autoscalingTagDescriptionsToSlice turns the list of tags into a slice. | [
"autoscalingTagDescriptionsToSlice",
"turns",
"the",
"list",
"of",
"tags",
"into",
"a",
"slice",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/autoscaling_tags.go#L252-L263 |
126,433 | terraform-providers/terraform-provider-aws | aws/resource_aws_vpc_dhcp_options_association.go | resourceAwsVpcDhcpOptionsAssociationDelete | func resourceAwsVpcDhcpOptionsAssociationDelete(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn
log.Printf("[INFO] Disassociating DHCP Options Set %s from VPC %s...", d.Get("dhcp_options_id"), d.Get("vpc_id"))
_, err := conn.AssociateDhcpOptions(&ec2.AssociateDhcpOptionsInput{
... | go | func resourceAwsVpcDhcpOptionsAssociationDelete(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn
log.Printf("[INFO] Disassociating DHCP Options Set %s from VPC %s...", d.Get("dhcp_options_id"), d.Get("vpc_id"))
_, err := conn.AssociateDhcpOptions(&ec2.AssociateDhcpOptionsInput{
... | [
"func",
"resourceAwsVpcDhcpOptionsAssociationDelete",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
")",
"error",
"{",
"conn",
":=",
"meta",
".",
"(",
"*",
"AWSClient",
")",
".",
"ec2conn",
"\n\n",
"log",
".",
"Printf",
... | // AWS does not provide an API to disassociate a DHCP Options set from a VPC.
// So, we do this by setting the VPC to the default DHCP Options Set. | [
"AWS",
"does",
"not",
"provide",
"an",
"API",
"to",
"disassociate",
"a",
"DHCP",
"Options",
"set",
"from",
"a",
"VPC",
".",
"So",
"we",
"do",
"this",
"by",
"setting",
"the",
"VPC",
"to",
"the",
"default",
"DHCP",
"Options",
"Set",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_vpc_dhcp_options_association.go#L86-L96 |
126,434 | terraform-providers/terraform-provider-aws | aws/resource_aws_subnet.go | SubnetStateRefreshFunc | func SubnetStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
resp, err := conn.DescribeSubnets(&ec2.DescribeSubnetsInput{
SubnetIds: []*string{aws.String(id)},
})
if err != nil {
if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "I... | go | func SubnetStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
resp, err := conn.DescribeSubnets(&ec2.DescribeSubnetsInput{
SubnetIds: []*string{aws.String(id)},
})
if err != nil {
if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "I... | [
"func",
"SubnetStateRefreshFunc",
"(",
"conn",
"*",
"ec2",
".",
"EC2",
",",
"id",
"string",
")",
"resource",
".",
"StateRefreshFunc",
"{",
"return",
"func",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"string",
",",
"error",
")",
"{",
"resp",
",",
"err"... | // SubnetStateRefreshFunc returns a resource.StateRefreshFunc that is used to watch a Subnet. | [
"SubnetStateRefreshFunc",
"returns",
"a",
"resource",
".",
"StateRefreshFunc",
"that",
"is",
"used",
"to",
"watch",
"a",
"Subnet",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_subnet.go#L365-L388 |
126,435 | terraform-providers/terraform-provider-aws | aws/resource_aws_organizations_account.go | resourceAwsOrganizationsAccountStateRefreshFunc | func resourceAwsOrganizationsAccountStateRefreshFunc(conn *organizations.Organizations, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
opts := &organizations.DescribeCreateAccountStatusInput{
CreateAccountRequestId: aws.String(id),
}
resp, err := conn.DescribeCreateAccount... | go | func resourceAwsOrganizationsAccountStateRefreshFunc(conn *organizations.Organizations, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
opts := &organizations.DescribeCreateAccountStatusInput{
CreateAccountRequestId: aws.String(id),
}
resp, err := conn.DescribeCreateAccount... | [
"func",
"resourceAwsOrganizationsAccountStateRefreshFunc",
"(",
"conn",
"*",
"organizations",
".",
"Organizations",
",",
"id",
"string",
")",
"resource",
".",
"StateRefreshFunc",
"{",
"return",
"func",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"string",
",",
"e... | // resourceAwsOrganizationsAccountStateRefreshFunc returns a resource.StateRefreshFunc
// that is used to watch a CreateAccount request | [
"resourceAwsOrganizationsAccountStateRefreshFunc",
"returns",
"a",
"resource",
".",
"StateRefreshFunc",
"that",
"is",
"used",
"to",
"watch",
"a",
"CreateAccount",
"request"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_organizations_account.go#L186-L213 |
126,436 | terraform-providers/terraform-provider-aws | aws/resource_aws_app_cookie_stickiness_policy.go | resourceAwsELBSticknessPolicyAssigned | func resourceAwsELBSticknessPolicyAssigned(policyName, lbName, lbPort string, elbconn *elb.ELB) (bool, error) {
describeElbOpts := &elb.DescribeLoadBalancersInput{
LoadBalancerNames: []*string{aws.String(lbName)},
}
describeResp, err := elbconn.DescribeLoadBalancers(describeElbOpts)
if err != nil {
if ec2err, o... | go | func resourceAwsELBSticknessPolicyAssigned(policyName, lbName, lbPort string, elbconn *elb.ELB) (bool, error) {
describeElbOpts := &elb.DescribeLoadBalancersInput{
LoadBalancerNames: []*string{aws.String(lbName)},
}
describeResp, err := elbconn.DescribeLoadBalancers(describeElbOpts)
if err != nil {
if ec2err, o... | [
"func",
"resourceAwsELBSticknessPolicyAssigned",
"(",
"policyName",
",",
"lbName",
",",
"lbPort",
"string",
",",
"elbconn",
"*",
"elb",
".",
"ELB",
")",
"(",
"bool",
",",
"error",
")",
"{",
"describeElbOpts",
":=",
"&",
"elb",
".",
"DescribeLoadBalancersInput",
... | // Determine if a particular policy is assigned to an ELB listener | [
"Determine",
"if",
"a",
"particular",
"policy",
"is",
"assigned",
"to",
"an",
"ELB",
"listener"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_app_cookie_stickiness_policy.go#L150-L184 |
126,437 | terraform-providers/terraform-provider-aws | aws/diff_suppress_funcs.go | suppressAwsDbEngineVersionDiffs | func suppressAwsDbEngineVersionDiffs(k, old, new string, d *schema.ResourceData) bool {
// First check if the old/new values are nil.
// If both are nil, we have no state to compare the values with, so register a diff.
// This populates the attribute field during a plan/apply with fresh state, allowing
// the attri... | go | func suppressAwsDbEngineVersionDiffs(k, old, new string, d *schema.ResourceData) bool {
// First check if the old/new values are nil.
// If both are nil, we have no state to compare the values with, so register a diff.
// This populates the attribute field during a plan/apply with fresh state, allowing
// the attri... | [
"func",
"suppressAwsDbEngineVersionDiffs",
"(",
"k",
",",
"old",
",",
"new",
"string",
",",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"bool",
"{",
"// First check if the old/new values are nil.",
"// If both are nil, we have no state to compare the values with, so register ... | // Suppresses minor version changes to the db_instance engine_version attribute | [
"Suppresses",
"minor",
"version",
"changes",
"to",
"the",
"db_instance",
"engine_version",
"attribute"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/diff_suppress_funcs.go#L45-L68 |
126,438 | terraform-providers/terraform-provider-aws | aws/tagsIAM.go | tagsFromMapIAM | func tagsFromMapIAM(m map[string]interface{}) []*iam.Tag {
result := make([]*iam.Tag, 0, len(m))
for k, v := range m {
t := &iam.Tag{
Key: aws.String(k),
Value: aws.String(v.(string)),
}
if !tagIgnoredIAM(t) {
result = append(result, t)
}
}
return result
} | go | func tagsFromMapIAM(m map[string]interface{}) []*iam.Tag {
result := make([]*iam.Tag, 0, len(m))
for k, v := range m {
t := &iam.Tag{
Key: aws.String(k),
Value: aws.String(v.(string)),
}
if !tagIgnoredIAM(t) {
result = append(result, t)
}
}
return result
} | [
"func",
"tagsFromMapIAM",
"(",
"m",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"[",
"]",
"*",
"iam",
".",
"Tag",
"{",
"result",
":=",
"make",
"(",
"[",
"]",
"*",
"iam",
".",
"Tag",
",",
"0",
",",
"len",
"(",
"m",
")",
")",
"\n",
... | // tagsFromMapIAM returns the tags for the given map of data for IAM. | [
"tagsFromMapIAM",
"returns",
"the",
"tags",
"for",
"the",
"given",
"map",
"of",
"data",
"for",
"IAM",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tagsIAM.go#L37-L50 |
126,439 | terraform-providers/terraform-provider-aws | aws/tagsIAM.go | tagsToMapIAM | func tagsToMapIAM(ts []*iam.Tag) map[string]string {
result := make(map[string]string)
for _, t := range ts {
if !tagIgnoredIAM(t) {
result[aws.StringValue(t.Key)] = aws.StringValue(t.Value)
}
}
return result
} | go | func tagsToMapIAM(ts []*iam.Tag) map[string]string {
result := make(map[string]string)
for _, t := range ts {
if !tagIgnoredIAM(t) {
result[aws.StringValue(t.Key)] = aws.StringValue(t.Value)
}
}
return result
} | [
"func",
"tagsToMapIAM",
"(",
"ts",
"[",
"]",
"*",
"iam",
".",
"Tag",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"result",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"t",
":=",
"range",
"ts",
"{",
"if... | // tagsToMapIAM turns the list of IAM tags into a map. | [
"tagsToMapIAM",
"turns",
"the",
"list",
"of",
"IAM",
"tags",
"into",
"a",
"map",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tagsIAM.go#L53-L62 |
126,440 | terraform-providers/terraform-provider-aws | aws/tagsIAM.go | tagKeysIam | func tagKeysIam(ts []*iam.Tag) []*string {
result := make([]*string, 0, len(ts))
for _, t := range ts {
result = append(result, t.Key)
}
return result
} | go | func tagKeysIam(ts []*iam.Tag) []*string {
result := make([]*string, 0, len(ts))
for _, t := range ts {
result = append(result, t.Key)
}
return result
} | [
"func",
"tagKeysIam",
"(",
"ts",
"[",
"]",
"*",
"iam",
".",
"Tag",
")",
"[",
"]",
"*",
"string",
"{",
"result",
":=",
"make",
"(",
"[",
"]",
"*",
"string",
",",
"0",
",",
"len",
"(",
"ts",
")",
")",
"\n",
"for",
"_",
",",
"t",
":=",
"range"... | // tagKeysIam returns the keys for the list of IAM tags | [
"tagKeysIam",
"returns",
"the",
"keys",
"for",
"the",
"list",
"of",
"IAM",
"tags"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tagsIAM.go#L80-L86 |
126,441 | terraform-providers/terraform-provider-aws | aws/resource_aws_codedeploy_deployment_group.go | buildOnPremTagFilters | func buildOnPremTagFilters(configured []interface{}) []*codedeploy.TagFilter {
filters := make([]*codedeploy.TagFilter, 0)
for _, raw := range configured {
var filter codedeploy.TagFilter
m := raw.(map[string]interface{})
if v, ok := m["key"]; ok {
filter.Key = aws.String(v.(string))
}
if v, ok := m["ty... | go | func buildOnPremTagFilters(configured []interface{}) []*codedeploy.TagFilter {
filters := make([]*codedeploy.TagFilter, 0)
for _, raw := range configured {
var filter codedeploy.TagFilter
m := raw.(map[string]interface{})
if v, ok := m["key"]; ok {
filter.Key = aws.String(v.(string))
}
if v, ok := m["ty... | [
"func",
"buildOnPremTagFilters",
"(",
"configured",
"[",
"]",
"interface",
"{",
"}",
")",
"[",
"]",
"*",
"codedeploy",
".",
"TagFilter",
"{",
"filters",
":=",
"make",
"(",
"[",
"]",
"*",
"codedeploy",
".",
"TagFilter",
",",
"0",
")",
"\n",
"for",
"_",
... | // buildOnPremTagFilters converts raw schema lists into a list of
// codedeploy.TagFilters. | [
"buildOnPremTagFilters",
"converts",
"raw",
"schema",
"lists",
"into",
"a",
"list",
"of",
"codedeploy",
".",
"TagFilters",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_codedeploy_deployment_group.go#L794-L814 |
126,442 | terraform-providers/terraform-provider-aws | aws/resource_aws_codedeploy_deployment_group.go | buildEC2TagFilters | func buildEC2TagFilters(configured []interface{}) []*codedeploy.EC2TagFilter {
filters := make([]*codedeploy.EC2TagFilter, 0)
for _, raw := range configured {
var filter codedeploy.EC2TagFilter
m := raw.(map[string]interface{})
filter.Key = aws.String(m["key"].(string))
filter.Type = aws.String(m["type"].(st... | go | func buildEC2TagFilters(configured []interface{}) []*codedeploy.EC2TagFilter {
filters := make([]*codedeploy.EC2TagFilter, 0)
for _, raw := range configured {
var filter codedeploy.EC2TagFilter
m := raw.(map[string]interface{})
filter.Key = aws.String(m["key"].(string))
filter.Type = aws.String(m["type"].(st... | [
"func",
"buildEC2TagFilters",
"(",
"configured",
"[",
"]",
"interface",
"{",
"}",
")",
"[",
"]",
"*",
"codedeploy",
".",
"EC2TagFilter",
"{",
"filters",
":=",
"make",
"(",
"[",
"]",
"*",
"codedeploy",
".",
"EC2TagFilter",
",",
"0",
")",
"\n",
"for",
"_... | // buildEC2TagFilters converts raw schema lists into a list of
// codedeploy.EC2TagFilters. | [
"buildEC2TagFilters",
"converts",
"raw",
"schema",
"lists",
"into",
"a",
"list",
"of",
"codedeploy",
".",
"EC2TagFilters",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_codedeploy_deployment_group.go#L818-L832 |
126,443 | terraform-providers/terraform-provider-aws | aws/resource_aws_codedeploy_deployment_group.go | buildEC2TagSet | func buildEC2TagSet(configured []interface{}) *codedeploy.EC2TagSet {
filterSets := make([][]*codedeploy.EC2TagFilter, 0)
for _, raw := range configured {
m := raw.(map[string]interface{})
rawFilters := m["ec2_tag_filter"].(*schema.Set)
filters := buildEC2TagFilters(rawFilters.List())
filterSets = append(filt... | go | func buildEC2TagSet(configured []interface{}) *codedeploy.EC2TagSet {
filterSets := make([][]*codedeploy.EC2TagFilter, 0)
for _, raw := range configured {
m := raw.(map[string]interface{})
rawFilters := m["ec2_tag_filter"].(*schema.Set)
filters := buildEC2TagFilters(rawFilters.List())
filterSets = append(filt... | [
"func",
"buildEC2TagSet",
"(",
"configured",
"[",
"]",
"interface",
"{",
"}",
")",
"*",
"codedeploy",
".",
"EC2TagSet",
"{",
"filterSets",
":=",
"make",
"(",
"[",
"]",
"[",
"]",
"*",
"codedeploy",
".",
"EC2TagFilter",
",",
"0",
")",
"\n",
"for",
"_",
... | // buildEC2TagSet converts raw schema lists into a codedeploy.EC2TagSet. | [
"buildEC2TagSet",
"converts",
"raw",
"schema",
"lists",
"into",
"a",
"codedeploy",
".",
"EC2TagSet",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_codedeploy_deployment_group.go#L835-L844 |
126,444 | terraform-providers/terraform-provider-aws | aws/resource_aws_codedeploy_deployment_group.go | buildTriggerConfigs | func buildTriggerConfigs(configured []interface{}) []*codedeploy.TriggerConfig {
configs := make([]*codedeploy.TriggerConfig, 0, len(configured))
for _, raw := range configured {
var config codedeploy.TriggerConfig
m := raw.(map[string]interface{})
config.TriggerEvents = expandStringSet(m["trigger_events"].(*s... | go | func buildTriggerConfigs(configured []interface{}) []*codedeploy.TriggerConfig {
configs := make([]*codedeploy.TriggerConfig, 0, len(configured))
for _, raw := range configured {
var config codedeploy.TriggerConfig
m := raw.(map[string]interface{})
config.TriggerEvents = expandStringSet(m["trigger_events"].(*s... | [
"func",
"buildTriggerConfigs",
"(",
"configured",
"[",
"]",
"interface",
"{",
"}",
")",
"[",
"]",
"*",
"codedeploy",
".",
"TriggerConfig",
"{",
"configs",
":=",
"make",
"(",
"[",
"]",
"*",
"codedeploy",
".",
"TriggerConfig",
",",
"0",
",",
"len",
"(",
... | // buildTriggerConfigs converts a raw schema list into a list of
// codedeploy.TriggerConfig. | [
"buildTriggerConfigs",
"converts",
"a",
"raw",
"schema",
"list",
"into",
"a",
"list",
"of",
"codedeploy",
".",
"TriggerConfig",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_codedeploy_deployment_group.go#L848-L861 |
126,445 | terraform-providers/terraform-provider-aws | aws/resource_aws_storagegateway_gateway.go | isAWSErrStorageGatewayGatewayNotFound | func isAWSErrStorageGatewayGatewayNotFound(err error) bool {
if isAWSErr(err, storagegateway.ErrCodeInvalidGatewayRequestException, "The specified gateway was not found.") {
return true
}
if isAWSErr(err, storagegateway.ErrorCodeGatewayNotFound, "") {
return true
}
return false
} | go | func isAWSErrStorageGatewayGatewayNotFound(err error) bool {
if isAWSErr(err, storagegateway.ErrCodeInvalidGatewayRequestException, "The specified gateway was not found.") {
return true
}
if isAWSErr(err, storagegateway.ErrorCodeGatewayNotFound, "") {
return true
}
return false
} | [
"func",
"isAWSErrStorageGatewayGatewayNotFound",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"isAWSErr",
"(",
"err",
",",
"storagegateway",
".",
"ErrCodeInvalidGatewayRequestException",
",",
"\"",
"\"",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"isAWSE... | // The API returns multiple responses for a missing gateway | [
"The",
"API",
"returns",
"multiple",
"responses",
"for",
"a",
"missing",
"gateway"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_storagegateway_gateway.go#L435-L443 |
126,446 | terraform-providers/terraform-provider-aws | aws/resource_aws_s3_bucket.go | validateS3BucketName | func validateS3BucketName(value string, region string) error {
if region != "us-east-1" {
if (len(value) < 3) || (len(value) > 63) {
return fmt.Errorf("%q must contain from 3 to 63 characters", value)
}
if !regexp.MustCompile(`^[0-9a-z-.]+$`).MatchString(value) {
return fmt.Errorf("only lowercase alphanume... | go | func validateS3BucketName(value string, region string) error {
if region != "us-east-1" {
if (len(value) < 3) || (len(value) > 63) {
return fmt.Errorf("%q must contain from 3 to 63 characters", value)
}
if !regexp.MustCompile(`^[0-9a-z-.]+$`).MatchString(value) {
return fmt.Errorf("only lowercase alphanume... | [
"func",
"validateS3BucketName",
"(",
"value",
"string",
",",
"region",
"string",
")",
"error",
"{",
"if",
"region",
"!=",
"\"",
"\"",
"{",
"if",
"(",
"len",
"(",
"value",
")",
"<",
"3",
")",
"||",
"(",
"len",
"(",
"value",
")",
">",
"63",
")",
"{... | // validateS3BucketName validates any S3 bucket name that is not inside the us-east-1 region.
// Buckets outside of this region have to be DNS-compliant. After the same restrictions are
// applied to buckets in the us-east-1 region, this function can be refactored as a SchemaValidateFunc | [
"validateS3BucketName",
"validates",
"any",
"S3",
"bucket",
"name",
"that",
"is",
"not",
"inside",
"the",
"us",
"-",
"east",
"-",
"1",
"region",
".",
"Buckets",
"outside",
"of",
"this",
"region",
"have",
"to",
"be",
"DNS",
"-",
"compliant",
".",
"After",
... | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_s3_bucket.go#L2307-L2336 |
126,447 | terraform-providers/terraform-provider-aws | aws/resource_aws_s3_bucket.go | readS3ObjectLockConfiguration | func readS3ObjectLockConfiguration(conn *s3.S3, bucket string) (interface{}, error) {
resp, err := retryOnAwsCode(s3.ErrCodeNoSuchBucket, func() (interface{}, error) {
return conn.GetObjectLockConfiguration(&s3.GetObjectLockConfigurationInput{
Bucket: aws.String(bucket),
})
})
if err != nil {
if isAWSErr(er... | go | func readS3ObjectLockConfiguration(conn *s3.S3, bucket string) (interface{}, error) {
resp, err := retryOnAwsCode(s3.ErrCodeNoSuchBucket, func() (interface{}, error) {
return conn.GetObjectLockConfiguration(&s3.GetObjectLockConfigurationInput{
Bucket: aws.String(bucket),
})
})
if err != nil {
if isAWSErr(er... | [
"func",
"readS3ObjectLockConfiguration",
"(",
"conn",
"*",
"s3",
".",
"S3",
",",
"bucket",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"retryOnAwsCode",
"(",
"s3",
".",
"ErrCodeNoSuchBucket",
",",
"func",
... | //
// S3 Object Lock functions.
// | [
"S3",
"Object",
"Lock",
"functions",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_s3_bucket.go#L2476-L2490 |
126,448 | terraform-providers/terraform-provider-aws | aws/tagsGeneric.go | tagsToMapGeneric | func tagsToMapGeneric(ts map[string]*string) map[string]string {
result := make(map[string]string)
for k, v := range ts {
if !tagIgnoredGeneric(k) {
result[k] = aws.StringValue(v)
}
}
return result
} | go | func tagsToMapGeneric(ts map[string]*string) map[string]string {
result := make(map[string]string)
for k, v := range ts {
if !tagIgnoredGeneric(k) {
result[k] = aws.StringValue(v)
}
}
return result
} | [
"func",
"tagsToMapGeneric",
"(",
"ts",
"map",
"[",
"string",
"]",
"*",
"string",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"result",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"ts",
... | // tagsToMap turns the tags into a map. | [
"tagsToMap",
"turns",
"the",
"tags",
"into",
"a",
"map",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tagsGeneric.go#L46-L55 |
126,449 | terraform-providers/terraform-provider-aws | aws/resource_aws_vpn_gateway.go | vpnGatewayAttachStateRefreshFunc | func vpnGatewayAttachStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
var start time.Time
return func() (interface{}, string, error) {
if start.IsZero() {
start = time.Now()
}
resp, err := conn.DescribeVpnGateways(&ec2.DescribeVpnGatewaysInput{
VpnGatewayIds: []*string{aws.String(id... | go | func vpnGatewayAttachStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
var start time.Time
return func() (interface{}, string, error) {
if start.IsZero() {
start = time.Now()
}
resp, err := conn.DescribeVpnGateways(&ec2.DescribeVpnGatewaysInput{
VpnGatewayIds: []*string{aws.String(id... | [
"func",
"vpnGatewayAttachStateRefreshFunc",
"(",
"conn",
"*",
"ec2",
".",
"EC2",
",",
"id",
"string",
")",
"resource",
".",
"StateRefreshFunc",
"{",
"var",
"start",
"time",
".",
"Time",
"\n",
"return",
"func",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"... | // vpnGatewayAttachStateRefreshFunc returns a resource.StateRefreshFunc that is used to watch
// the state of a VPN gateway's attachment | [
"vpnGatewayAttachStateRefreshFunc",
"returns",
"a",
"resource",
".",
"StateRefreshFunc",
"that",
"is",
"used",
"to",
"watch",
"the",
"state",
"of",
"a",
"VPN",
"gateway",
"s",
"attachment"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_vpn_gateway.go#L296-L331 |
126,450 | terraform-providers/terraform-provider-aws | aws/utils.go | base64Encode | func base64Encode(data []byte) string {
// Check whether the data is already Base64 encoded; don't double-encode
if isBase64Encoded(data) {
return string(data)
}
// data has not been encoded encode and return
return base64.StdEncoding.EncodeToString(data)
} | go | func base64Encode(data []byte) string {
// Check whether the data is already Base64 encoded; don't double-encode
if isBase64Encoded(data) {
return string(data)
}
// data has not been encoded encode and return
return base64.StdEncoding.EncodeToString(data)
} | [
"func",
"base64Encode",
"(",
"data",
"[",
"]",
"byte",
")",
"string",
"{",
"// Check whether the data is already Base64 encoded; don't double-encode",
"if",
"isBase64Encoded",
"(",
"data",
")",
"{",
"return",
"string",
"(",
"data",
")",
"\n",
"}",
"\n",
"// data has... | // Base64Encode encodes data if the input isn't already encoded using base64.StdEncoding.EncodeToString.
// If the input is already base64 encoded, return the original input unchanged. | [
"Base64Encode",
"encodes",
"data",
"if",
"the",
"input",
"isn",
"t",
"already",
"encoded",
"using",
"base64",
".",
"StdEncoding",
".",
"EncodeToString",
".",
"If",
"the",
"input",
"is",
"already",
"base64",
"encoded",
"return",
"the",
"original",
"input",
"unc... | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/utils.go#L14-L21 |
126,451 | terraform-providers/terraform-provider-aws | aws/s3_tags.go | getTagSetS3 | func getTagSetS3(s3conn *s3.S3, bucket string) ([]*s3.Tag, error) {
request := &s3.GetBucketTaggingInput{
Bucket: aws.String(bucket),
}
response, err := s3conn.GetBucketTagging(request)
if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "NoSuchTagSet" {
// There is no tag set associated with the bucke... | go | func getTagSetS3(s3conn *s3.S3, bucket string) ([]*s3.Tag, error) {
request := &s3.GetBucketTaggingInput{
Bucket: aws.String(bucket),
}
response, err := s3conn.GetBucketTagging(request)
if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "NoSuchTagSet" {
// There is no tag set associated with the bucke... | [
"func",
"getTagSetS3",
"(",
"s3conn",
"*",
"s3",
".",
"S3",
",",
"bucket",
"string",
")",
"(",
"[",
"]",
"*",
"s3",
".",
"Tag",
",",
"error",
")",
"{",
"request",
":=",
"&",
"s3",
".",
"GetBucketTaggingInput",
"{",
"Bucket",
":",
"aws",
".",
"Strin... | // return a slice of s3 tags associated with the given s3 bucket. Essentially
// s3.GetBucketTagging, except returns an empty slice instead of an error when
// there are no tags. | [
"return",
"a",
"slice",
"of",
"s3",
"tags",
"associated",
"with",
"the",
"given",
"s3",
"bucket",
".",
"Essentially",
"s3",
".",
"GetBucketTagging",
"except",
"returns",
"an",
"empty",
"slice",
"instead",
"of",
"an",
"error",
"when",
"there",
"are",
"no",
... | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/s3_tags.go#L160-L174 |
126,452 | terraform-providers/terraform-provider-aws | aws/resource_aws_route.go | resourceAwsRoute | func resourceAwsRoute() *schema.Resource {
return &schema.Resource{
Create: resourceAwsRouteCreate,
Read: resourceAwsRouteRead,
Update: resourceAwsRouteUpdate,
Delete: resourceAwsRouteDelete,
Exists: resourceAwsRouteExists,
Importer: &schema.ResourceImporter{
State: func(d *schema.ResourceData, meta i... | go | func resourceAwsRoute() *schema.Resource {
return &schema.Resource{
Create: resourceAwsRouteCreate,
Read: resourceAwsRouteRead,
Update: resourceAwsRouteUpdate,
Delete: resourceAwsRouteDelete,
Exists: resourceAwsRouteExists,
Importer: &schema.ResourceImporter{
State: func(d *schema.ResourceData, meta i... | [
"func",
"resourceAwsRoute",
"(",
")",
"*",
"schema",
".",
"Resource",
"{",
"return",
"&",
"schema",
".",
"Resource",
"{",
"Create",
":",
"resourceAwsRouteCreate",
",",
"Read",
":",
"resourceAwsRouteRead",
",",
"Update",
":",
"resourceAwsRouteUpdate",
",",
"Delet... | // AWS Route resource Schema declaration | [
"AWS",
"Route",
"resource",
"Schema",
"declaration"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_route.go#L24-L134 |
126,453 | terraform-providers/terraform-provider-aws | aws/resource_aws_vpc.go | VPCStateRefreshFunc | func VPCStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
describeVpcOpts := &ec2.DescribeVpcsInput{
VpcIds: []*string{aws.String(id)},
}
resp, err := conn.DescribeVpcs(describeVpcOpts)
if err != nil {
if ec2err, ok := err.(awserr.Error); ... | go | func VPCStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
describeVpcOpts := &ec2.DescribeVpcsInput{
VpcIds: []*string{aws.String(id)},
}
resp, err := conn.DescribeVpcs(describeVpcOpts)
if err != nil {
if ec2err, ok := err.(awserr.Error); ... | [
"func",
"VPCStateRefreshFunc",
"(",
"conn",
"*",
"ec2",
".",
"EC2",
",",
"id",
"string",
")",
"resource",
".",
"StateRefreshFunc",
"{",
"return",
"func",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"string",
",",
"error",
")",
"{",
"describeVpcOpts",
":="... | // VPCStateRefreshFunc returns a resource.StateRefreshFunc that is used to watch
// a VPC. | [
"VPCStateRefreshFunc",
"returns",
"a",
"resource",
".",
"StateRefreshFunc",
"that",
"is",
"used",
"to",
"watch",
"a",
"VPC",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_vpc.go#L524-L548 |
126,454 | terraform-providers/terraform-provider-aws | aws/resource_aws_vpc.go | vpcDescribe | func vpcDescribe(conn *ec2.EC2, vpcId string) (*ec2.Vpc, error) {
resp, err := conn.DescribeVpcs(&ec2.DescribeVpcsInput{
VpcIds: aws.StringSlice([]string{vpcId}),
})
if err != nil {
if !isAWSErr(err, "InvalidVpcID.NotFound", "") {
return nil, err
}
resp = nil
}
if resp == nil {
return nil, nil
}
n... | go | func vpcDescribe(conn *ec2.EC2, vpcId string) (*ec2.Vpc, error) {
resp, err := conn.DescribeVpcs(&ec2.DescribeVpcsInput{
VpcIds: aws.StringSlice([]string{vpcId}),
})
if err != nil {
if !isAWSErr(err, "InvalidVpcID.NotFound", "") {
return nil, err
}
resp = nil
}
if resp == nil {
return nil, nil
}
n... | [
"func",
"vpcDescribe",
"(",
"conn",
"*",
"ec2",
".",
"EC2",
",",
"vpcId",
"string",
")",
"(",
"*",
"ec2",
".",
"Vpc",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"conn",
".",
"DescribeVpcs",
"(",
"&",
"ec2",
".",
"DescribeVpcsInput",
"{",
"Vp... | // vpcDescribe returns EC2 API information about the specified VPC.
// If the VPC doesn't exist, return nil. | [
"vpcDescribe",
"returns",
"EC2",
"API",
"information",
"about",
"the",
"specified",
"VPC",
".",
"If",
"the",
"VPC",
"doesn",
"t",
"exist",
"return",
"nil",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_vpc.go#L706-L732 |
126,455 | terraform-providers/terraform-provider-aws | aws/resource_aws_route_table.go | resourceAwsRouteTableStateRefreshFunc | func resourceAwsRouteTableStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
resp, err := conn.DescribeRouteTables(&ec2.DescribeRouteTablesInput{
RouteTableIds: []*string{aws.String(id)},
})
if err != nil {
if ec2err, ok := err.(awserr.Error)... | go | func resourceAwsRouteTableStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
resp, err := conn.DescribeRouteTables(&ec2.DescribeRouteTablesInput{
RouteTableIds: []*string{aws.String(id)},
})
if err != nil {
if ec2err, ok := err.(awserr.Error)... | [
"func",
"resourceAwsRouteTableStateRefreshFunc",
"(",
"conn",
"*",
"ec2",
".",
"EC2",
",",
"id",
"string",
")",
"resource",
".",
"StateRefreshFunc",
"{",
"return",
"func",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"string",
",",
"error",
")",
"{",
"resp",... | // resourceAwsRouteTableStateRefreshFunc returns a resource.StateRefreshFunc that is used to watch
// a RouteTable. | [
"resourceAwsRouteTableStateRefreshFunc",
"returns",
"a",
"resource",
".",
"StateRefreshFunc",
"that",
"is",
"used",
"to",
"watch",
"a",
"RouteTable",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_route_table.go#L531-L554 |
126,456 | terraform-providers/terraform-provider-aws | aws/tags.go | tagsSchema | func tagsSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeMap,
Optional: true,
}
} | go | func tagsSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeMap,
Optional: true,
}
} | [
"func",
"tagsSchema",
"(",
")",
"*",
"schema",
".",
"Schema",
"{",
"return",
"&",
"schema",
".",
"Schema",
"{",
"Type",
":",
"schema",
".",
"TypeMap",
",",
"Optional",
":",
"true",
",",
"}",
"\n",
"}"
] | // tagsSchema returns the schema to use for tags.
// | [
"tagsSchema",
"returns",
"the",
"schema",
"to",
"use",
"for",
"tags",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tags.go#L22-L27 |
126,457 | terraform-providers/terraform-provider-aws | aws/tags.go | tagsToMapELBv2 | func tagsToMapELBv2(ts []*elbv2.Tag) map[string]string {
result := make(map[string]string)
for _, t := range ts {
if !tagIgnoredELBv2(t) {
result[*t.Key] = *t.Value
}
}
return result
} | go | func tagsToMapELBv2(ts []*elbv2.Tag) map[string]string {
result := make(map[string]string)
for _, t := range ts {
if !tagIgnoredELBv2(t) {
result[*t.Key] = *t.Value
}
}
return result
} | [
"func",
"tagsToMapELBv2",
"(",
"ts",
"[",
"]",
"*",
"elbv2",
".",
"Tag",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"result",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"t",
":=",
"range",
"ts",
"{",
... | // tagsToMapELBv2 turns the list of tags into a map. | [
"tagsToMapELBv2",
"turns",
"the",
"list",
"of",
"tags",
"into",
"a",
"map",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tags.go#L316-L325 |
126,458 | terraform-providers/terraform-provider-aws | aws/tags.go | tagsFromMapELBv2 | func tagsFromMapELBv2(m map[string]interface{}) []*elbv2.Tag {
var result []*elbv2.Tag
for k, v := range m {
t := &elbv2.Tag{
Key: aws.String(k),
Value: aws.String(v.(string)),
}
if !tagIgnoredELBv2(t) {
result = append(result, t)
}
}
return result
} | go | func tagsFromMapELBv2(m map[string]interface{}) []*elbv2.Tag {
var result []*elbv2.Tag
for k, v := range m {
t := &elbv2.Tag{
Key: aws.String(k),
Value: aws.String(v.(string)),
}
if !tagIgnoredELBv2(t) {
result = append(result, t)
}
}
return result
} | [
"func",
"tagsFromMapELBv2",
"(",
"m",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"[",
"]",
"*",
"elbv2",
".",
"Tag",
"{",
"var",
"result",
"[",
"]",
"*",
"elbv2",
".",
"Tag",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"m",
"{",
"t",... | // tagsFromMapELBv2 returns the tags for the given map of data. | [
"tagsFromMapELBv2",
"returns",
"the",
"tags",
"for",
"the",
"given",
"map",
"of",
"data",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tags.go#L328-L341 |
126,459 | terraform-providers/terraform-provider-aws | aws/tags.go | tagsToMapDynamoDb | func tagsToMapDynamoDb(ts []*dynamodb.Tag) map[string]string {
result := make(map[string]string)
for _, t := range ts {
result[*t.Key] = *t.Value
}
return result
} | go | func tagsToMapDynamoDb(ts []*dynamodb.Tag) map[string]string {
result := make(map[string]string)
for _, t := range ts {
result[*t.Key] = *t.Value
}
return result
} | [
"func",
"tagsToMapDynamoDb",
"(",
"ts",
"[",
"]",
"*",
"dynamodb",
".",
"Tag",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"result",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"t",
":=",
"range",
"ts",
... | // tagsToMapDynamoDb turns the list of tags into a map for dynamoDB | [
"tagsToMapDynamoDb",
"turns",
"the",
"list",
"of",
"tags",
"into",
"a",
"map",
"for",
"dynamoDB"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tags.go#L373-L379 |
126,460 | terraform-providers/terraform-provider-aws | aws/tags.go | tagsFromMapDynamoDb | func tagsFromMapDynamoDb(m map[string]interface{}) []*dynamodb.Tag {
result := make([]*dynamodb.Tag, 0, len(m))
for k, v := range m {
t := &dynamodb.Tag{
Key: aws.String(k),
Value: aws.String(v.(string)),
}
result = append(result, t)
}
return result
} | go | func tagsFromMapDynamoDb(m map[string]interface{}) []*dynamodb.Tag {
result := make([]*dynamodb.Tag, 0, len(m))
for k, v := range m {
t := &dynamodb.Tag{
Key: aws.String(k),
Value: aws.String(v.(string)),
}
result = append(result, t)
}
return result
} | [
"func",
"tagsFromMapDynamoDb",
"(",
"m",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"[",
"]",
"*",
"dynamodb",
".",
"Tag",
"{",
"result",
":=",
"make",
"(",
"[",
"]",
"*",
"dynamodb",
".",
"Tag",
",",
"0",
",",
"len",
"(",
"m",
")",
... | // tagsFromMapDynamoDb returns the tags for a given map | [
"tagsFromMapDynamoDb",
"returns",
"the",
"tags",
"for",
"a",
"given",
"map"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tags.go#L382-L392 |
126,461 | terraform-providers/terraform-provider-aws | aws/tags.go | setTagsDynamoDb | func setTagsDynamoDb(conn *dynamodb.DynamoDB, d *schema.ResourceData) error {
arn := d.Get("arn").(string)
oraw, nraw := d.GetChange("tags")
o := oraw.(map[string]interface{})
n := nraw.(map[string]interface{})
create, remove := diffTagsDynamoDb(tagsFromMapDynamoDb(o), tagsFromMapDynamoDb(n))
// Set tags
if len... | go | func setTagsDynamoDb(conn *dynamodb.DynamoDB, d *schema.ResourceData) error {
arn := d.Get("arn").(string)
oraw, nraw := d.GetChange("tags")
o := oraw.(map[string]interface{})
n := nraw.(map[string]interface{})
create, remove := diffTagsDynamoDb(tagsFromMapDynamoDb(o), tagsFromMapDynamoDb(n))
// Set tags
if len... | [
"func",
"setTagsDynamoDb",
"(",
"conn",
"*",
"dynamodb",
".",
"DynamoDB",
",",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"error",
"{",
"arn",
":=",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
"\n",
"oraw",
",",
"nraw",
":=",... | // setTagsDynamoDb is a helper to set the tags for a dynamoDB resource
// This is needed because dynamodb requires a completely different set and delete
// method from the ec2 tag resource handling. Also the `UntagResource` method
// for dynamoDB only requires a list of tag keys, instead of the full map of keys. | [
"setTagsDynamoDb",
"is",
"a",
"helper",
"to",
"set",
"the",
"tags",
"for",
"a",
"dynamoDB",
"resource",
"This",
"is",
"needed",
"because",
"dynamodb",
"requires",
"a",
"completely",
"different",
"set",
"and",
"delete",
"method",
"from",
"the",
"ec2",
"tag",
... | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tags.go#L398-L446 |
126,462 | terraform-providers/terraform-provider-aws | aws/tags.go | diffTagsDynamoDb | func diffTagsDynamoDb(oldTags, newTags []*dynamodb.Tag) ([]*dynamodb.Tag, []*string) {
create := make(map[string]interface{})
for _, t := range newTags {
create[*t.Key] = *t.Value
}
var remove []*string
for _, t := range oldTags {
// Verify the old tag is not a tag we're currently attempting to create
old, ... | go | func diffTagsDynamoDb(oldTags, newTags []*dynamodb.Tag) ([]*dynamodb.Tag, []*string) {
create := make(map[string]interface{})
for _, t := range newTags {
create[*t.Key] = *t.Value
}
var remove []*string
for _, t := range oldTags {
// Verify the old tag is not a tag we're currently attempting to create
old, ... | [
"func",
"diffTagsDynamoDb",
"(",
"oldTags",
",",
"newTags",
"[",
"]",
"*",
"dynamodb",
".",
"Tag",
")",
"(",
"[",
"]",
"*",
"dynamodb",
".",
"Tag",
",",
"[",
"]",
"*",
"string",
")",
"{",
"create",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"i... | // diffTagsDynamoDb takes a local set of dynamodb tags and the ones found remotely
// and returns the set of tags that must be created as a map, and returns a list of tag keys
// that must be destroyed. | [
"diffTagsDynamoDb",
"takes",
"a",
"local",
"set",
"of",
"dynamodb",
"tags",
"and",
"the",
"ones",
"found",
"remotely",
"and",
"returns",
"the",
"set",
"of",
"tags",
"that",
"must",
"be",
"created",
"as",
"a",
"map",
"and",
"returns",
"a",
"list",
"of",
"... | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tags.go#L451-L466 |
126,463 | terraform-providers/terraform-provider-aws | aws/tags.go | tagsMapToRaw | func tagsMapToRaw(m map[string]string) map[string]interface{} {
raw := make(map[string]interface{})
for k, v := range m {
raw[k] = v
}
return raw
} | go | func tagsMapToRaw(m map[string]string) map[string]interface{} {
raw := make(map[string]interface{})
for k, v := range m {
raw[k] = v
}
return raw
} | [
"func",
"tagsMapToRaw",
"(",
"m",
"map",
"[",
"string",
"]",
"string",
")",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"raw",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"for",
"k",
",",
"v",
":=",
... | // tagsMapToRaw converts a tags map to its "raw" type. | [
"tagsMapToRaw",
"converts",
"a",
"tags",
"map",
"to",
"its",
"raw",
"type",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tags.go#L479-L486 |
126,464 | terraform-providers/terraform-provider-aws | aws/tags.go | ec2TagSpecificationsFromMap | func ec2TagSpecificationsFromMap(m map[string]interface{}, t string) []*ec2.TagSpecification {
if len(m) == 0 {
return nil
}
return []*ec2.TagSpecification{
{
ResourceType: aws.String(t),
Tags: tagsFromMap(m),
},
}
} | go | func ec2TagSpecificationsFromMap(m map[string]interface{}, t string) []*ec2.TagSpecification {
if len(m) == 0 {
return nil
}
return []*ec2.TagSpecification{
{
ResourceType: aws.String(t),
Tags: tagsFromMap(m),
},
}
} | [
"func",
"ec2TagSpecificationsFromMap",
"(",
"m",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"t",
"string",
")",
"[",
"]",
"*",
"ec2",
".",
"TagSpecification",
"{",
"if",
"len",
"(",
"m",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
... | // ec2TagSpecificationsFromMap returns the tag specifications for the given map of data m and resource type t. | [
"ec2TagSpecificationsFromMap",
"returns",
"the",
"tag",
"specifications",
"for",
"the",
"given",
"map",
"of",
"data",
"m",
"and",
"resource",
"type",
"t",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/tags.go#L489-L500 |
126,465 | terraform-providers/terraform-provider-aws | aws/resource_aws_vpn_connection.go | routesToMapList | func routesToMapList(routes []*ec2.VpnStaticRoute) []map[string]interface{} {
result := make([]map[string]interface{}, 0, len(routes))
for _, r := range routes {
staticRoute := make(map[string]interface{})
staticRoute["destination_cidr_block"] = *r.DestinationCidrBlock
staticRoute["state"] = *r.State
if r.So... | go | func routesToMapList(routes []*ec2.VpnStaticRoute) []map[string]interface{} {
result := make([]map[string]interface{}, 0, len(routes))
for _, r := range routes {
staticRoute := make(map[string]interface{})
staticRoute["destination_cidr_block"] = *r.DestinationCidrBlock
staticRoute["state"] = *r.State
if r.So... | [
"func",
"routesToMapList",
"(",
"routes",
"[",
"]",
"*",
"ec2",
".",
"VpnStaticRoute",
")",
"[",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"result",
":=",
"make",
"(",
"[",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",... | // routesToMapList turns the list of routes into a list of maps. | [
"routesToMapList",
"turns",
"the",
"list",
"of",
"routes",
"into",
"a",
"list",
"of",
"maps",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_vpn_connection.go#L549-L564 |
126,466 | terraform-providers/terraform-provider-aws | aws/resource_aws_vpn_connection.go | telemetryToMapList | func telemetryToMapList(telemetry []*ec2.VgwTelemetry) []map[string]interface{} {
result := make([]map[string]interface{}, 0, len(telemetry))
for _, t := range telemetry {
vgw := make(map[string]interface{})
vgw["accepted_route_count"] = *t.AcceptedRouteCount
vgw["outside_ip_address"] = *t.OutsideIpAddress
vg... | go | func telemetryToMapList(telemetry []*ec2.VgwTelemetry) []map[string]interface{} {
result := make([]map[string]interface{}, 0, len(telemetry))
for _, t := range telemetry {
vgw := make(map[string]interface{})
vgw["accepted_route_count"] = *t.AcceptedRouteCount
vgw["outside_ip_address"] = *t.OutsideIpAddress
vg... | [
"func",
"telemetryToMapList",
"(",
"telemetry",
"[",
"]",
"*",
"ec2",
".",
"VgwTelemetry",
")",
"[",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"result",
":=",
"make",
"(",
"[",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
... | // telemetryToMapList turns the VGW telemetry into a list of maps. | [
"telemetryToMapList",
"turns",
"the",
"VGW",
"telemetry",
"into",
"a",
"list",
"of",
"maps",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_vpn_connection.go#L567-L583 |
126,467 | terraform-providers/terraform-provider-aws | aws/datasync_tags.go | dataSyncTagsDiff | func dataSyncTagsDiff(oldTags, newTags []*datasync.TagListEntry) ([]*datasync.TagListEntry, []*datasync.TagListEntry) {
// First, we're creating everything we have
create := make(map[string]interface{})
for _, t := range newTags {
create[aws.StringValue(t.Key)] = aws.StringValue(t.Value)
}
// Build the list of ... | go | func dataSyncTagsDiff(oldTags, newTags []*datasync.TagListEntry) ([]*datasync.TagListEntry, []*datasync.TagListEntry) {
// First, we're creating everything we have
create := make(map[string]interface{})
for _, t := range newTags {
create[aws.StringValue(t.Key)] = aws.StringValue(t.Value)
}
// Build the list of ... | [
"func",
"dataSyncTagsDiff",
"(",
"oldTags",
",",
"newTags",
"[",
"]",
"*",
"datasync",
".",
"TagListEntry",
")",
"(",
"[",
"]",
"*",
"datasync",
".",
"TagListEntry",
",",
"[",
"]",
"*",
"datasync",
".",
"TagListEntry",
")",
"{",
"// First, we're creating eve... | // dataSyncTagsDiff takes our tags locally and the ones remotely and returns
// the set of tags that must be created, and the set of tags that must
// be destroyed. | [
"dataSyncTagsDiff",
"takes",
"our",
"tags",
"locally",
"and",
"the",
"ones",
"remotely",
"and",
"returns",
"the",
"set",
"of",
"tags",
"that",
"must",
"be",
"created",
"and",
"the",
"set",
"of",
"tags",
"that",
"must",
"be",
"destroyed",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/datasync_tags.go#L11-L29 |
126,468 | terraform-providers/terraform-provider-aws | aws/resource_aws_cloudfront_distribution.go | resourceAwsCloudFrontDistributionWaitUntilDeployed | func resourceAwsCloudFrontDistributionWaitUntilDeployed(id string, meta interface{}) error {
stateConf := &resource.StateChangeConf{
Pending: []string{"InProgress"},
Target: []string{"Deployed"},
Refresh: resourceAwsCloudFrontWebDistributionStateRefreshFunc(id, meta),
Timeout: 70 * time.Minute,
... | go | func resourceAwsCloudFrontDistributionWaitUntilDeployed(id string, meta interface{}) error {
stateConf := &resource.StateChangeConf{
Pending: []string{"InProgress"},
Target: []string{"Deployed"},
Refresh: resourceAwsCloudFrontWebDistributionStateRefreshFunc(id, meta),
Timeout: 70 * time.Minute,
... | [
"func",
"resourceAwsCloudFrontDistributionWaitUntilDeployed",
"(",
"id",
"string",
",",
"meta",
"interface",
"{",
"}",
")",
"error",
"{",
"stateConf",
":=",
"&",
"resource",
".",
"StateChangeConf",
"{",
"Pending",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",... | // resourceAwsCloudFrontWebDistributionWaitUntilDeployed blocks until the
// distribution is deployed. It currently takes exactly 15 minutes to deploy
// but that might change in the future. | [
"resourceAwsCloudFrontWebDistributionWaitUntilDeployed",
"blocks",
"until",
"the",
"distribution",
"is",
"deployed",
".",
"It",
"currently",
"takes",
"exactly",
"15",
"minutes",
"to",
"deploy",
"but",
"that",
"might",
"change",
"in",
"the",
"future",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_cloudfront_distribution.go#L1053-L1065 |
126,469 | terraform-providers/terraform-provider-aws | aws/resource_aws_cloudfront_distribution.go | resourceAwsCloudFrontWebDistributionStateRefreshFunc | func resourceAwsCloudFrontWebDistributionStateRefreshFunc(id string, meta interface{}) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
conn := meta.(*AWSClient).cloudfrontconn
params := &cloudfront.GetDistributionInput{
Id: aws.String(id),
}
resp, err := conn.GetDistribution(params... | go | func resourceAwsCloudFrontWebDistributionStateRefreshFunc(id string, meta interface{}) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
conn := meta.(*AWSClient).cloudfrontconn
params := &cloudfront.GetDistributionInput{
Id: aws.String(id),
}
resp, err := conn.GetDistribution(params... | [
"func",
"resourceAwsCloudFrontWebDistributionStateRefreshFunc",
"(",
"id",
"string",
",",
"meta",
"interface",
"{",
"}",
")",
"resource",
".",
"StateRefreshFunc",
"{",
"return",
"func",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"string",
",",
"error",
")",
"{... | // The refresh function for resourceAwsCloudFrontWebDistributionWaitUntilDeployed. | [
"The",
"refresh",
"function",
"for",
"resourceAwsCloudFrontWebDistributionWaitUntilDeployed",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_cloudfront_distribution.go#L1068-L1087 |
126,470 | terraform-providers/terraform-provider-aws | aws/resource_aws_sns_topic_subscription.go | subscriptionHasPendingConfirmation | func subscriptionHasPendingConfirmation(arn *string) bool {
if arn != nil && !strings.Contains(strings.Replace(strings.ToLower(*arn), " ", "", -1), awsSNSPendingConfirmationMessageWithoutSpaces) {
return false
}
return true
} | go | func subscriptionHasPendingConfirmation(arn *string) bool {
if arn != nil && !strings.Contains(strings.Replace(strings.ToLower(*arn), " ", "", -1), awsSNSPendingConfirmationMessageWithoutSpaces) {
return false
}
return true
} | [
"func",
"subscriptionHasPendingConfirmation",
"(",
"arn",
"*",
"string",
")",
"bool",
"{",
"if",
"arn",
"!=",
"nil",
"&&",
"!",
"strings",
".",
"Contains",
"(",
"strings",
".",
"Replace",
"(",
"strings",
".",
"ToLower",
"(",
"*",
"arn",
")",
",",
"\"",
... | // returns true if arn is nil or has both pending and confirmation words in the arn | [
"returns",
"true",
"if",
"arn",
"is",
"nil",
"or",
"has",
"both",
"pending",
"and",
"confirmation",
"words",
"in",
"the",
"arn"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_sns_topic_subscription.go#L296-L302 |
126,471 | terraform-providers/terraform-provider-aws | aws/resource_aws_sns_topic_subscription.go | obfuscateEndpoint | func obfuscateEndpoint(endpoint string) string {
res, err := url.Parse(endpoint)
if err != nil {
fmt.Println(err)
}
var obfuscatedEndpoint = res.String()
// If the user is defined, we try to get the username and password, if defined.
// Then, we update the user with the obfuscated version.
if res.User != nil... | go | func obfuscateEndpoint(endpoint string) string {
res, err := url.Parse(endpoint)
if err != nil {
fmt.Println(err)
}
var obfuscatedEndpoint = res.String()
// If the user is defined, we try to get the username and password, if defined.
// Then, we update the user with the obfuscated version.
if res.User != nil... | [
"func",
"obfuscateEndpoint",
"(",
"endpoint",
"string",
")",
"string",
"{",
"res",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"endpoint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"var",
"... | // returns the endpoint with obfuscated password, if any | [
"returns",
"the",
"endpoint",
"with",
"obfuscated",
"password",
"if",
"any"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_sns_topic_subscription.go#L305-L321 |
126,472 | terraform-providers/terraform-provider-aws | aws/data_source_aws_elastic_beanstalk_solution_stack.go | dataSourceAwsElasticBeanstalkSolutionStackRead | func dataSourceAwsElasticBeanstalkSolutionStackRead(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).elasticbeanstalkconn
nameRegex := d.Get("name_regex")
var params *elasticbeanstalk.ListAvailableSolutionStacksInput
log.Printf("[DEBUG] Reading Elastic Beanstalk Solution Stack: %s", pa... | go | func dataSourceAwsElasticBeanstalkSolutionStackRead(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).elasticbeanstalkconn
nameRegex := d.Get("name_regex")
var params *elasticbeanstalk.ListAvailableSolutionStacksInput
log.Printf("[DEBUG] Reading Elastic Beanstalk Solution Stack: %s", pa... | [
"func",
"dataSourceAwsElasticBeanstalkSolutionStackRead",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
")",
"error",
"{",
"conn",
":=",
"meta",
".",
"(",
"*",
"AWSClient",
")",
".",
"elasticbeanstalkconn",
"\n\n",
"nameRegex"... | // dataSourceAwsElasticBeanstalkSolutionStackRead performs the API lookup. | [
"dataSourceAwsElasticBeanstalkSolutionStackRead",
"performs",
"the",
"API",
"lookup",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/data_source_aws_elastic_beanstalk_solution_stack.go#L40-L83 |
126,473 | terraform-providers/terraform-provider-aws | aws/resource_aws_internet_gateway.go | IGStateRefreshFunc | func IGStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
resp, err := conn.DescribeInternetGateways(&ec2.DescribeInternetGatewaysInput{
InternetGatewayIds: []*string{aws.String(id)},
})
if err != nil {
ec2err, ok := err.(awserr.Error)
if ... | go | func IGStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
resp, err := conn.DescribeInternetGateways(&ec2.DescribeInternetGatewaysInput{
InternetGatewayIds: []*string{aws.String(id)},
})
if err != nil {
ec2err, ok := err.(awserr.Error)
if ... | [
"func",
"IGStateRefreshFunc",
"(",
"conn",
"*",
"ec2",
".",
"EC2",
",",
"id",
"string",
")",
"resource",
".",
"StateRefreshFunc",
"{",
"return",
"func",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"string",
",",
"error",
")",
"{",
"resp",
",",
"err",
... | // IGStateRefreshFunc returns a resource.StateRefreshFunc that is used to watch
// an internet gateway. | [
"IGStateRefreshFunc",
"returns",
"a",
"resource",
".",
"StateRefreshFunc",
"that",
"is",
"used",
"to",
"watch",
"an",
"internet",
"gateway",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_internet_gateway.go#L323-L347 |
126,474 | terraform-providers/terraform-provider-aws | aws/resource_aws_internet_gateway.go | IGAttachStateRefreshFunc | func IGAttachStateRefreshFunc(conn *ec2.EC2, id string, expected string) resource.StateRefreshFunc {
var start time.Time
return func() (interface{}, string, error) {
if start.IsZero() {
start = time.Now()
}
resp, err := conn.DescribeInternetGateways(&ec2.DescribeInternetGatewaysInput{
InternetGatewayIds:... | go | func IGAttachStateRefreshFunc(conn *ec2.EC2, id string, expected string) resource.StateRefreshFunc {
var start time.Time
return func() (interface{}, string, error) {
if start.IsZero() {
start = time.Now()
}
resp, err := conn.DescribeInternetGateways(&ec2.DescribeInternetGatewaysInput{
InternetGatewayIds:... | [
"func",
"IGAttachStateRefreshFunc",
"(",
"conn",
"*",
"ec2",
".",
"EC2",
",",
"id",
"string",
",",
"expected",
"string",
")",
"resource",
".",
"StateRefreshFunc",
"{",
"var",
"start",
"time",
".",
"Time",
"\n",
"return",
"func",
"(",
")",
"(",
"interface",... | // IGAttachStateRefreshFunc returns a resource.StateRefreshFunc that is used
// watch the state of an internet gateway's attachment. | [
"IGAttachStateRefreshFunc",
"returns",
"a",
"resource",
".",
"StateRefreshFunc",
"that",
"is",
"used",
"watch",
"the",
"state",
"of",
"an",
"internet",
"gateway",
"s",
"attachment",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_internet_gateway.go#L351-L390 |
126,475 | terraform-providers/terraform-provider-aws | aws/import_aws_network_acl.go | resourceAwsNetworkAclImportState | func resourceAwsNetworkAclImportState(
d *schema.ResourceData,
meta interface{}) ([]*schema.ResourceData, error) {
conn := meta.(*AWSClient).ec2conn
// First query the resource itself
resp, err := conn.DescribeNetworkAcls(&ec2.DescribeNetworkAclsInput{
NetworkAclIds: []*string{aws.String(d.Id())},
})
if err !... | go | func resourceAwsNetworkAclImportState(
d *schema.ResourceData,
meta interface{}) ([]*schema.ResourceData, error) {
conn := meta.(*AWSClient).ec2conn
// First query the resource itself
resp, err := conn.DescribeNetworkAcls(&ec2.DescribeNetworkAclsInput{
NetworkAclIds: []*string{aws.String(d.Id())},
})
if err !... | [
"func",
"resourceAwsNetworkAclImportState",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
")",
"(",
"[",
"]",
"*",
"schema",
".",
"ResourceData",
",",
"error",
")",
"{",
"conn",
":=",
"meta",
".",
"(",
"*",
"AWSClient"... | // Network ACLs import their rules and associations | [
"Network",
"ACLs",
"import",
"their",
"rules",
"and",
"associations"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/import_aws_network_acl.go#L12-L95 |
126,476 | terraform-providers/terraform-provider-aws | aws/resource_aws_cognito_identity_pool_roles_attachment.go | validateRoleMappings | func validateRoleMappings(roleMappings []interface{}) []error {
errors := make([]error, 0)
for _, r := range roleMappings {
rm := r.(map[string]interface{})
// If Type equals "Token" or "Rules", ambiguous_role_resolution must be defined.
// This should be removed as soon as we can have a ValidateFuncAgainst c... | go | func validateRoleMappings(roleMappings []interface{}) []error {
errors := make([]error, 0)
for _, r := range roleMappings {
rm := r.(map[string]interface{})
// If Type equals "Token" or "Rules", ambiguous_role_resolution must be defined.
// This should be removed as soon as we can have a ValidateFuncAgainst c... | [
"func",
"validateRoleMappings",
"(",
"roleMappings",
"[",
"]",
"interface",
"{",
"}",
")",
"[",
"]",
"error",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n\n",
"for",
"_",
",",
"r",
":=",
"range",
"roleMappings",
"{",
"rm",
... | // Validating that each role_mapping ambiguous_role_resolution
// is defined when "type" equals Token or Rules. | [
"Validating",
"that",
"each",
"role_mapping",
"ambiguous_role_resolution",
"is",
"defined",
"when",
"type",
"equals",
"Token",
"or",
"Rules",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_cognito_identity_pool_roles_attachment.go#L242-L262 |
126,477 | terraform-providers/terraform-provider-aws | aws/resource_aws_emr_instance_group.go | readEmrEBSConfig | func readEmrEBSConfig(d *schema.ResourceData) *emr.EbsConfiguration {
result := &emr.EbsConfiguration{}
if v, ok := d.GetOk("ebs_optimized"); ok {
result.EbsOptimized = aws.Bool(v.(bool))
}
ebsConfigs := make([]*emr.EbsBlockDeviceConfig, 0)
if rawConfig, ok := d.GetOk("ebs_config"); ok {
configList := rawConf... | go | func readEmrEBSConfig(d *schema.ResourceData) *emr.EbsConfiguration {
result := &emr.EbsConfiguration{}
if v, ok := d.GetOk("ebs_optimized"); ok {
result.EbsOptimized = aws.Bool(v.(bool))
}
ebsConfigs := make([]*emr.EbsBlockDeviceConfig, 0)
if rawConfig, ok := d.GetOk("ebs_config"); ok {
configList := rawConf... | [
"func",
"readEmrEBSConfig",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"emr",
".",
"EbsConfiguration",
"{",
"result",
":=",
"&",
"emr",
".",
"EbsConfiguration",
"{",
"}",
"\n",
"if",
"v",
",",
"ok",
":=",
"d",
".",
"GetOk",
"(",
"\"",
"\... | // Populates an emr.EbsConfiguration struct | [
"Populates",
"an",
"emr",
".",
"EbsConfiguration",
"struct"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_emr_instance_group.go#L89-L117 |
126,478 | terraform-providers/terraform-provider-aws | aws/cloudfront_distribution_configuration_structure.go | originHash | func originHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["origin_id"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["domain_name"].(string)))
if v, ok := m["custom_header"]; ok {
buf.WriteString(fmt.Sprintf("%d-", customHeadersHash(v.(*schem... | go | func originHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["origin_id"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["domain_name"].(string)))
if v, ok := m["custom_header"]; ok {
buf.WriteString(fmt.Sprintf("%d-", customHeadersHash(v.(*schem... | [
"func",
"originHash",
"(",
"v",
"interface",
"{",
"}",
")",
"int",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"m",
":=",
"v",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"buf",
".",
"WriteString",
"(",
"fmt",
".",... | // Assemble the hash for the aws_cloudfront_distribution origin
// TypeSet attribute. | [
"Assemble",
"the",
"hash",
"for",
"the",
"aws_cloudfront_distribution",
"origin",
"TypeSet",
"attribute",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/cloudfront_distribution_configuration_structure.go#L706-L728 |
126,479 | terraform-providers/terraform-provider-aws | aws/cloudfront_distribution_configuration_structure.go | originGroupHash | func originGroupHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["origin_id"].(string)))
if v, ok := m["failover_criteria"]; ok {
if l := v.([]interface{}); len(l) > 0 {
buf.WriteString(fmt.Sprintf("%d-", failoverCriteriaHash(l[0])))
}
}
if... | go | func originGroupHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["origin_id"].(string)))
if v, ok := m["failover_criteria"]; ok {
if l := v.([]interface{}); len(l) > 0 {
buf.WriteString(fmt.Sprintf("%d-", failoverCriteriaHash(l[0])))
}
}
if... | [
"func",
"originGroupHash",
"(",
"v",
"interface",
"{",
"}",
")",
"int",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"m",
":=",
"v",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"buf",
".",
"WriteString",
"(",
"fmt",
... | // Assemble the hash for the aws_cloudfront_distribution origin group
// TypeSet attribute. | [
"Assemble",
"the",
"hash",
"for",
"the",
"aws_cloudfront_distribution",
"origin",
"group",
"TypeSet",
"attribute",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/cloudfront_distribution_configuration_structure.go#L732-L749 |
126,480 | terraform-providers/terraform-provider-aws | aws/cloudfront_distribution_configuration_structure.go | customHeadersHash | func customHeadersHash(s *schema.Set) int {
var buf bytes.Buffer
for _, v := range s.List() {
buf.WriteString(fmt.Sprintf("%d-", originCustomHeaderHash(v)))
}
return hashcode.String(buf.String())
} | go | func customHeadersHash(s *schema.Set) int {
var buf bytes.Buffer
for _, v := range s.List() {
buf.WriteString(fmt.Sprintf("%d-", originCustomHeaderHash(v)))
}
return hashcode.String(buf.String())
} | [
"func",
"customHeadersHash",
"(",
"s",
"*",
"schema",
".",
"Set",
")",
"int",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"s",
".",
"List",
"(",
")",
"{",
"buf",
".",
"WriteString",
"(",
"fmt",
".",
"Spri... | // Helper function used by originHash to get a composite hash for all
// aws_cloudfront_distribution custom_header attributes. | [
"Helper",
"function",
"used",
"by",
"originHash",
"to",
"get",
"a",
"composite",
"hash",
"for",
"all",
"aws_cloudfront_distribution",
"custom_header",
"attributes",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/cloudfront_distribution_configuration_structure.go#L805-L811 |
126,481 | terraform-providers/terraform-provider-aws | aws/cloudfront_distribution_configuration_structure.go | customOriginConfigHash | func customOriginConfigHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["origin_protocol_policy"].(string)))
buf.WriteString(fmt.Sprintf("%d-", m["http_port"].(int)))
buf.WriteString(fmt.Sprintf("%d-", m["https_port"].(int)))
for _, v := range sor... | go | func customOriginConfigHash(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["origin_protocol_policy"].(string)))
buf.WriteString(fmt.Sprintf("%d-", m["http_port"].(int)))
buf.WriteString(fmt.Sprintf("%d-", m["https_port"].(int)))
for _, v := range sor... | [
"func",
"customOriginConfigHash",
"(",
"v",
"interface",
"{",
"}",
")",
"int",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"m",
":=",
"v",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"buf",
".",
"WriteString",
"(",
"... | // Assemble the hash for the aws_cloudfront_distribution custom_origin_config
// TypeSet attribute. | [
"Assemble",
"the",
"hash",
"for",
"the",
"aws_cloudfront_distribution",
"custom_origin_config",
"TypeSet",
"attribute",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/cloudfront_distribution_configuration_structure.go#L853-L866 |
126,482 | terraform-providers/terraform-provider-aws | aws/validators.go | validateTypeStringNullableFloat | func validateTypeStringNullableFloat(v interface{}, k string) (ws []string, es []error) {
value, ok := v.(string)
if !ok {
es = append(es, fmt.Errorf("expected type of %s to be string", k))
return
}
if value == "" {
return
}
if _, err := strconv.ParseFloat(value, 64); err != nil {
es = append(es, fmt.Er... | go | func validateTypeStringNullableFloat(v interface{}, k string) (ws []string, es []error) {
value, ok := v.(string)
if !ok {
es = append(es, fmt.Errorf("expected type of %s to be string", k))
return
}
if value == "" {
return
}
if _, err := strconv.ParseFloat(value, 64); err != nil {
es = append(es, fmt.Er... | [
"func",
"validateTypeStringNullableFloat",
"(",
"v",
"interface",
"{",
"}",
",",
"k",
"string",
")",
"(",
"ws",
"[",
"]",
"string",
",",
"es",
"[",
"]",
"error",
")",
"{",
"value",
",",
"ok",
":=",
"v",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"... | // validateTypeStringNullableFloat provides custom error messaging for TypeString floats
// Some arguments require a floating point value or an unspecified, empty field. | [
"validateTypeStringNullableFloat",
"provides",
"custom",
"error",
"messaging",
"for",
"TypeString",
"floats",
"Some",
"arguments",
"require",
"a",
"floating",
"point",
"value",
"or",
"an",
"unspecified",
"empty",
"field",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/validators.go#L67-L83 |
126,483 | terraform-providers/terraform-provider-aws | aws/validators.go | validateTagFilters | func validateTagFilters(v interface{}, k string) (ws []string, errors []error) {
value := v.(string)
if value != "KEY_ONLY" && value != "VALUE_ONLY" && value != "KEY_AND_VALUE" {
errors = append(errors, fmt.Errorf(
"%q must be one of \"KEY_ONLY\", \"VALUE_ONLY\", or \"KEY_AND_VALUE\"", k))
}
return
} | go | func validateTagFilters(v interface{}, k string) (ws []string, errors []error) {
value := v.(string)
if value != "KEY_ONLY" && value != "VALUE_ONLY" && value != "KEY_AND_VALUE" {
errors = append(errors, fmt.Errorf(
"%q must be one of \"KEY_ONLY\", \"VALUE_ONLY\", or \"KEY_AND_VALUE\"", k))
}
return
} | [
"func",
"validateTagFilters",
"(",
"v",
"interface",
"{",
"}",
",",
"k",
"string",
")",
"(",
"ws",
"[",
"]",
"string",
",",
"errors",
"[",
"]",
"error",
")",
"{",
"value",
":=",
"v",
".",
"(",
"string",
")",
"\n",
"if",
"value",
"!=",
"\"",
"\"",... | // validateTagFilters confirms the "value" component of a tag filter is one of
// AWS's three allowed types. | [
"validateTagFilters",
"confirms",
"the",
"value",
"component",
"of",
"a",
"tag",
"filter",
"is",
"one",
"of",
"AWS",
"s",
"three",
"allowed",
"types",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/validators.go#L236-L243 |
126,484 | terraform-providers/terraform-provider-aws | aws/validators.go | validateCIDRNetworkAddress | func validateCIDRNetworkAddress(v interface{}, k string) (ws []string, errors []error) {
value := v.(string)
_, ipnet, err := net.ParseCIDR(value)
if err != nil {
errors = append(errors, fmt.Errorf(
"%q must contain a valid CIDR, got error parsing: %s", k, err))
return
}
if ipnet == nil || value != ipnet.S... | go | func validateCIDRNetworkAddress(v interface{}, k string) (ws []string, errors []error) {
value := v.(string)
_, ipnet, err := net.ParseCIDR(value)
if err != nil {
errors = append(errors, fmt.Errorf(
"%q must contain a valid CIDR, got error parsing: %s", k, err))
return
}
if ipnet == nil || value != ipnet.S... | [
"func",
"validateCIDRNetworkAddress",
"(",
"v",
"interface",
"{",
"}",
",",
"k",
"string",
")",
"(",
"ws",
"[",
"]",
"string",
",",
"errors",
"[",
"]",
"error",
")",
"{",
"value",
":=",
"v",
".",
"(",
"string",
")",
"\n",
"_",
",",
"ipnet",
",",
... | // validateCIDRNetworkAddress ensures that the string value is a valid CIDR that
// represents a network address - it adds an error otherwise | [
"validateCIDRNetworkAddress",
"ensures",
"that",
"the",
"string",
"value",
"is",
"a",
"valid",
"CIDR",
"that",
"represents",
"a",
"network",
"address",
"-",
"it",
"adds",
"an",
"error",
"otherwise"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/validators.go#L739-L754 |
126,485 | terraform-providers/terraform-provider-aws | aws/validators.go | validateAwsEcsPlacementConstraint | func validateAwsEcsPlacementConstraint(constType, constExpr string) error {
switch constType {
case "distinctInstance":
// Expression can be nil for distinctInstance
return nil
case "memberOf":
if constExpr == "" {
return fmt.Errorf("Expression cannot be nil for 'memberOf' type")
}
default:
return fmt.... | go | func validateAwsEcsPlacementConstraint(constType, constExpr string) error {
switch constType {
case "distinctInstance":
// Expression can be nil for distinctInstance
return nil
case "memberOf":
if constExpr == "" {
return fmt.Errorf("Expression cannot be nil for 'memberOf' type")
}
default:
return fmt.... | [
"func",
"validateAwsEcsPlacementConstraint",
"(",
"constType",
",",
"constExpr",
"string",
")",
"error",
"{",
"switch",
"constType",
"{",
"case",
"\"",
"\"",
":",
"// Expression can be nil for distinctInstance",
"return",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"if",
... | // Validates that ECS Placement Constraints are set correctly
// Takes type, and expression as strings | [
"Validates",
"that",
"ECS",
"Placement",
"Constraints",
"are",
"set",
"correctly",
"Takes",
"type",
"and",
"expression",
"as",
"strings"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/validators.go#L995-L1008 |
126,486 | terraform-providers/terraform-provider-aws | aws/validators.go | validateAwsEcsPlacementStrategy | func validateAwsEcsPlacementStrategy(stratType, stratField string) error {
switch stratType {
case "random":
// random requires the field attribute to be unset.
if stratField != "" {
return fmt.Errorf("Random type requires the field attribute to be unset. Got: %s",
stratField)
}
case "spread":
// For... | go | func validateAwsEcsPlacementStrategy(stratType, stratField string) error {
switch stratType {
case "random":
// random requires the field attribute to be unset.
if stratField != "" {
return fmt.Errorf("Random type requires the field attribute to be unset. Got: %s",
stratField)
}
case "spread":
// For... | [
"func",
"validateAwsEcsPlacementStrategy",
"(",
"stratType",
",",
"stratField",
"string",
")",
"error",
"{",
"switch",
"stratType",
"{",
"case",
"\"",
"\"",
":",
"// random requires the field attribute to be unset.",
"if",
"stratField",
"!=",
"\"",
"\"",
"{",
"return"... | // Validates that an Ecs placement strategy is set correctly
// Takes type, and field as strings | [
"Validates",
"that",
"an",
"Ecs",
"placement",
"strategy",
"is",
"set",
"correctly",
"Takes",
"type",
"and",
"field",
"as",
"strings"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/validators.go#L1025-L1048 |
126,487 | terraform-providers/terraform-provider-aws | aws/validators.go | validateCognitoRoles | func validateCognitoRoles(v map[string]interface{}) (errors []error) {
k := "roles"
_, hasAuthenticated := v["authenticated"].(string)
_, hasUnauthenticated := v["unauthenticated"].(string)
if !hasAuthenticated && !hasUnauthenticated {
errors = append(errors, fmt.Errorf("%q: Either \"authenticated\" or \"unauthe... | go | func validateCognitoRoles(v map[string]interface{}) (errors []error) {
k := "roles"
_, hasAuthenticated := v["authenticated"].(string)
_, hasUnauthenticated := v["unauthenticated"].(string)
if !hasAuthenticated && !hasUnauthenticated {
errors = append(errors, fmt.Errorf("%q: Either \"authenticated\" or \"unauthe... | [
"func",
"validateCognitoRoles",
"(",
"v",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"errors",
"[",
"]",
"error",
")",
"{",
"k",
":=",
"\"",
"\"",
"\n",
"_",
",",
"hasAuthenticated",
":=",
"v",
"[",
"\"",
"\"",
"]",
".",
"(",
"st... | // Validates that either authenticated or unauthenticated is defined | [
"Validates",
"that",
"either",
"authenticated",
"or",
"unauthenticated",
"is",
"defined"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/validators.go#L1960-L1970 |
126,488 | terraform-providers/terraform-provider-aws | aws/resource_aws_network_interface_sg_attachment.go | fetchNetworkInterface | func fetchNetworkInterface(conn *ec2.EC2, ifaceID string) (*ec2.NetworkInterface, error) {
log.Printf("[DEBUG] Fetching information for interface ID %s", ifaceID)
dniParams := &ec2.DescribeNetworkInterfacesInput{
NetworkInterfaceIds: aws.StringSlice([]string{ifaceID}),
}
dniResp, err := conn.DescribeNetworkInter... | go | func fetchNetworkInterface(conn *ec2.EC2, ifaceID string) (*ec2.NetworkInterface, error) {
log.Printf("[DEBUG] Fetching information for interface ID %s", ifaceID)
dniParams := &ec2.DescribeNetworkInterfacesInput{
NetworkInterfaceIds: aws.StringSlice([]string{ifaceID}),
}
dniResp, err := conn.DescribeNetworkInter... | [
"func",
"fetchNetworkInterface",
"(",
"conn",
"*",
"ec2",
".",
"EC2",
",",
"ifaceID",
"string",
")",
"(",
"*",
"ec2",
".",
"NetworkInterface",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"ifaceID",
")",
"\n",
"dniParams",
":=",
... | // fetchNetworkInterface is a utility function used by Read and Delete to fetch
// the full ENI details for a specific interface ID. | [
"fetchNetworkInterface",
"is",
"a",
"utility",
"function",
"used",
"by",
"Read",
"and",
"Delete",
"to",
"fetch",
"the",
"full",
"ENI",
"details",
"for",
"a",
"specific",
"interface",
"ID",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_network_interface_sg_attachment.go#L132-L143 |
126,489 | terraform-providers/terraform-provider-aws | aws/resource_aws_security_group.go | SGStateRefreshFunc | func SGStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
req := &ec2.DescribeSecurityGroupsInput{
GroupIds: []*string{aws.String(id)},
}
resp, err := conn.DescribeSecurityGroups(req)
if err != nil {
if ec2err, ok := err.(awserr.Error); ok ... | go | func SGStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
req := &ec2.DescribeSecurityGroupsInput{
GroupIds: []*string{aws.String(id)},
}
resp, err := conn.DescribeSecurityGroups(req)
if err != nil {
if ec2err, ok := err.(awserr.Error); ok ... | [
"func",
"SGStateRefreshFunc",
"(",
"conn",
"*",
"ec2",
".",
"EC2",
",",
"id",
"string",
")",
"resource",
".",
"StateRefreshFunc",
"{",
"return",
"func",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"string",
",",
"error",
")",
"{",
"req",
":=",
"&",
"e... | // SGStateRefreshFunc returns a resource.StateRefreshFunc that is used to watch
// a security group. | [
"SGStateRefreshFunc",
"returns",
"a",
"resource",
".",
"StateRefreshFunc",
"that",
"is",
"used",
"to",
"watch",
"a",
"security",
"group",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_security_group.go#L791-L819 |
126,490 | terraform-providers/terraform-provider-aws | aws/resource_aws_security_group.go | idCollapseHash | func idCollapseHash(rType, protocol string, toPort, fromPort int64, description string) string {
var buf bytes.Buffer
buf.WriteString(fmt.Sprintf("%s-", rType))
buf.WriteString(fmt.Sprintf("%d-", toPort))
buf.WriteString(fmt.Sprintf("%d-", fromPort))
buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(protocol)))
... | go | func idCollapseHash(rType, protocol string, toPort, fromPort int64, description string) string {
var buf bytes.Buffer
buf.WriteString(fmt.Sprintf("%s-", rType))
buf.WriteString(fmt.Sprintf("%d-", toPort))
buf.WriteString(fmt.Sprintf("%d-", fromPort))
buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(protocol)))
... | [
"func",
"idCollapseHash",
"(",
"rType",
",",
"protocol",
"string",
",",
"toPort",
",",
"fromPort",
"int64",
",",
"description",
"string",
")",
"string",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"buf",
".",
"WriteString",
"(",
"fmt",
".",
"Sprintf",... | // Convert type-to_port-from_port-protocol-description tuple
// to a hash to use as a key in Set. | [
"Convert",
"type",
"-",
"to_port",
"-",
"from_port",
"-",
"protocol",
"-",
"description",
"tuple",
"to",
"a",
"hash",
"to",
"use",
"as",
"a",
"key",
"in",
"Set",
"."
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_security_group.go#L1314-L1323 |
126,491 | terraform-providers/terraform-provider-aws | aws/resource_aws_security_group.go | idHash | func idHash(rType, protocol string, toPort, fromPort int64, self bool) string {
var buf bytes.Buffer
buf.WriteString(fmt.Sprintf("%s-", rType))
buf.WriteString(fmt.Sprintf("%d-", toPort))
buf.WriteString(fmt.Sprintf("%d-", fromPort))
buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(protocol)))
buf.WriteString(f... | go | func idHash(rType, protocol string, toPort, fromPort int64, self bool) string {
var buf bytes.Buffer
buf.WriteString(fmt.Sprintf("%s-", rType))
buf.WriteString(fmt.Sprintf("%d-", toPort))
buf.WriteString(fmt.Sprintf("%d-", fromPort))
buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(protocol)))
buf.WriteString(f... | [
"func",
"idHash",
"(",
"rType",
",",
"protocol",
"string",
",",
"toPort",
",",
"fromPort",
"int64",
",",
"self",
"bool",
")",
"string",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"buf",
".",
"WriteString",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
... | // Creates a unique hash for the type, ports, and protocol, used as a key in
// maps | [
"Creates",
"a",
"unique",
"hash",
"for",
"the",
"type",
"ports",
"and",
"protocol",
"used",
"as",
"a",
"key",
"in",
"maps"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_security_group.go#L1327-L1336 |
126,492 | terraform-providers/terraform-provider-aws | aws/resource_aws_security_group.go | protocolStateFunc | func protocolStateFunc(v interface{}) string {
switch v := v.(type) {
case string:
p := protocolForValue(v)
return p
default:
log.Printf("[WARN] Non String value given for Protocol: %#v", v)
return ""
}
} | go | func protocolStateFunc(v interface{}) string {
switch v := v.(type) {
case string:
p := protocolForValue(v)
return p
default:
log.Printf("[WARN] Non String value given for Protocol: %#v", v)
return ""
}
} | [
"func",
"protocolStateFunc",
"(",
"v",
"interface",
"{",
"}",
")",
"string",
"{",
"switch",
"v",
":=",
"v",
".",
"(",
"type",
")",
"{",
"case",
"string",
":",
"p",
":=",
"protocolForValue",
"(",
"v",
")",
"\n",
"return",
"p",
"\n",
"default",
":",
... | // protocolStateFunc ensures we only store a string in any protocol field | [
"protocolStateFunc",
"ensures",
"we",
"only",
"store",
"a",
"string",
"in",
"any",
"protocol",
"field"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_security_group.go#L1339-L1348 |
126,493 | terraform-providers/terraform-provider-aws | aws/resource_aws_security_group.go | deleteLingeringLambdaENIs | func deleteLingeringLambdaENIs(conn *ec2.EC2, d *schema.ResourceData, filterName string) error {
// Here we carefully find the offenders
params := &ec2.DescribeNetworkInterfacesInput{
Filters: []*ec2.Filter{
{
Name: aws.String(filterName),
Values: []*string{aws.String(d.Id())},
},
{
Name: a... | go | func deleteLingeringLambdaENIs(conn *ec2.EC2, d *schema.ResourceData, filterName string) error {
// Here we carefully find the offenders
params := &ec2.DescribeNetworkInterfacesInput{
Filters: []*ec2.Filter{
{
Name: aws.String(filterName),
Values: []*string{aws.String(d.Id())},
},
{
Name: a... | [
"func",
"deleteLingeringLambdaENIs",
"(",
"conn",
"*",
"ec2",
".",
"EC2",
",",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"filterName",
"string",
")",
"error",
"{",
"// Here we carefully find the offenders",
"params",
":=",
"&",
"ec2",
".",
"DescribeNetworkInte... | // The AWS Lambda service creates ENIs behind the scenes and keeps these around for a while
// which would prevent SGs attached to such ENIs from being destroyed | [
"The",
"AWS",
"Lambda",
"service",
"creates",
"ENIs",
"behind",
"the",
"scenes",
"and",
"keeps",
"these",
"around",
"for",
"a",
"while",
"which",
"would",
"prevent",
"SGs",
"attached",
"to",
"such",
"ENIs",
"from",
"being",
"destroyed"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_security_group.go#L1403-L1472 |
126,494 | terraform-providers/terraform-provider-aws | aws/resource_aws_security_group_rule.go | validateAwsSecurityGroupRule | func validateAwsSecurityGroupRule(d *schema.ResourceData) error {
blocks, blocksOk := d.GetOk("cidr_blocks")
self, selfOk := d.GetOk("self")
if blocksOk && self.(bool) {
return fmt.Errorf("'self': conflicts with 'cidr_blocks' (%#v)", blocks)
}
_, ipv6Ok := d.GetOk("ipv6_cidr_blocks")
_, sourceOk := d.GetOk("so... | go | func validateAwsSecurityGroupRule(d *schema.ResourceData) error {
blocks, blocksOk := d.GetOk("cidr_blocks")
self, selfOk := d.GetOk("self")
if blocksOk && self.(bool) {
return fmt.Errorf("'self': conflicts with 'cidr_blocks' (%#v)", blocks)
}
_, ipv6Ok := d.GetOk("ipv6_cidr_blocks")
_, sourceOk := d.GetOk("so... | [
"func",
"validateAwsSecurityGroupRule",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"error",
"{",
"blocks",
",",
"blocksOk",
":=",
"d",
".",
"GetOk",
"(",
"\"",
"\"",
")",
"\n",
"self",
",",
"selfOk",
":=",
"d",
".",
"GetOk",
"(",
"\"",
"\"",
... | // Validates that either 'cidr_blocks', 'ipv6_cidr_blocks', 'self', or 'source_security_group_id' is set | [
"Validates",
"that",
"either",
"cidr_blocks",
"ipv6_cidr_blocks",
"self",
"or",
"source_security_group_id",
"is",
"set"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_security_group_rule.go#L839-L854 |
126,495 | terraform-providers/terraform-provider-aws | aws/resource_aws_security_group_rule.go | validateSecurityGroupRuleImportString | func validateSecurityGroupRuleImportString(importStr string) ([]string, error) {
// example: sg-09a093729ef9382a6_ingress_tcp_8000_8000_10.0.3.0/24
// example: sg-09a093729ef9382a6_ingress_92_0_65536_10.0.3.0/24_10.0.4.0/24
// example: sg-09a093729ef9382a6_egress_tcp_8000_8000_10.0.3.0/24
// example: sg-09a093729ef... | go | func validateSecurityGroupRuleImportString(importStr string) ([]string, error) {
// example: sg-09a093729ef9382a6_ingress_tcp_8000_8000_10.0.3.0/24
// example: sg-09a093729ef9382a6_ingress_92_0_65536_10.0.3.0/24_10.0.4.0/24
// example: sg-09a093729ef9382a6_egress_tcp_8000_8000_10.0.3.0/24
// example: sg-09a093729ef... | [
"func",
"validateSecurityGroupRuleImportString",
"(",
"importStr",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"// example: sg-09a093729ef9382a6_ingress_tcp_8000_8000_10.0.3.0/24",
"// example: sg-09a093729ef9382a6_ingress_92_0_65536_10.0.3.0/24_10.0.4.0/24",
"// ... | // validateSecurityGroupRuleImportString does minimal validation of import string without going to AWS | [
"validateSecurityGroupRuleImportString",
"does",
"minimal",
"validation",
"of",
"import",
"string",
"without",
"going",
"to",
"AWS"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_security_group_rule.go#L905-L957 |
126,496 | terraform-providers/terraform-provider-aws | aws/resource_aws_default_route_table.go | revokeAllRouteTableRules | func revokeAllRouteTableRules(defaultRouteTableId string, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn
log.Printf("\n***\nrevokeAllRouteTableRules\n***\n")
resp, err := conn.DescribeRouteTables(&ec2.DescribeRouteTablesInput{
RouteTableIds: []*string{aws.String(defaultRouteTableId)},
})
if err != ... | go | func revokeAllRouteTableRules(defaultRouteTableId string, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn
log.Printf("\n***\nrevokeAllRouteTableRules\n***\n")
resp, err := conn.DescribeRouteTables(&ec2.DescribeRouteTablesInput{
RouteTableIds: []*string{aws.String(defaultRouteTableId)},
})
if err != ... | [
"func",
"revokeAllRouteTableRules",
"(",
"defaultRouteTableId",
"string",
",",
"meta",
"interface",
"{",
"}",
")",
"error",
"{",
"conn",
":=",
"meta",
".",
"(",
"*",
"AWSClient",
")",
".",
"ec2conn",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\\n",
"... | // revokeAllRouteTableRules revoke all routes on the Default Route Table
// This should only be ran once at creation time of this resource | [
"revokeAllRouteTableRules",
"revoke",
"all",
"routes",
"on",
"the",
"Default",
"Route",
"Table",
"This",
"should",
"only",
"be",
"ran",
"once",
"at",
"creation",
"time",
"of",
"this",
"resource"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_default_route_table.go#L174-L246 |
126,497 | terraform-providers/terraform-provider-aws | aws/resource_aws_db_instance.go | resourceAwsDbInstanceRetrieve | func resourceAwsDbInstanceRetrieve(id string, conn *rds.RDS) (*rds.DBInstance, error) {
opts := rds.DescribeDBInstancesInput{
DBInstanceIdentifier: aws.String(id),
}
log.Printf("[DEBUG] DB Instance describe configuration: %#v", opts)
resp, err := conn.DescribeDBInstances(&opts)
if err != nil {
if isAWSErr(er... | go | func resourceAwsDbInstanceRetrieve(id string, conn *rds.RDS) (*rds.DBInstance, error) {
opts := rds.DescribeDBInstancesInput{
DBInstanceIdentifier: aws.String(id),
}
log.Printf("[DEBUG] DB Instance describe configuration: %#v", opts)
resp, err := conn.DescribeDBInstances(&opts)
if err != nil {
if isAWSErr(er... | [
"func",
"resourceAwsDbInstanceRetrieve",
"(",
"id",
"string",
",",
"conn",
"*",
"rds",
".",
"RDS",
")",
"(",
"*",
"rds",
".",
"DBInstance",
",",
"error",
")",
"{",
"opts",
":=",
"rds",
".",
"DescribeDBInstancesInput",
"{",
"DBInstanceIdentifier",
":",
"aws",... | // resourceAwsDbInstanceRetrieve fetches DBInstance information from the AWS
// API. It returns an error if there is a communication problem or unexpected
// error with AWS. When the DBInstance is not found, it returns no error and a
// nil pointer. | [
"resourceAwsDbInstanceRetrieve",
"fetches",
"DBInstance",
"information",
"from",
"the",
"AWS",
"API",
".",
"It",
"returns",
"an",
"error",
"if",
"there",
"is",
"a",
"communication",
"problem",
"or",
"unexpected",
"error",
"with",
"AWS",
".",
"When",
"the",
"DBIn... | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_db_instance.go#L1532-L1552 |
126,498 | terraform-providers/terraform-provider-aws | aws/resource_aws_spot_instance_request.go | resourceAwsSpotInstanceRequestRead | func resourceAwsSpotInstanceRequestRead(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn
req := &ec2.DescribeSpotInstanceRequestsInput{
SpotInstanceRequestIds: []*string{aws.String(d.Id())},
}
resp, err := conn.DescribeSpotInstanceRequests(req)
if err != nil {
// If the spo... | go | func resourceAwsSpotInstanceRequestRead(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn
req := &ec2.DescribeSpotInstanceRequestsInput{
SpotInstanceRequestIds: []*string{aws.String(d.Id())},
}
resp, err := conn.DescribeSpotInstanceRequests(req)
if err != nil {
// If the spo... | [
"func",
"resourceAwsSpotInstanceRequestRead",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
")",
"error",
"{",
"conn",
":=",
"meta",
".",
"(",
"*",
"AWSClient",
")",
".",
"ec2conn",
"\n\n",
"req",
":=",
"&",
"ec2",
"."... | // Update spot state, etc | [
"Update",
"spot",
"state",
"etc"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_spot_instance_request.go#L230-L283 |
126,499 | terraform-providers/terraform-provider-aws | aws/resource_aws_spot_instance_request.go | SpotInstanceStateRefreshFunc | func SpotInstanceStateRefreshFunc(
conn *ec2.EC2, sir ec2.SpotInstanceRequest) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
resp, err := conn.DescribeSpotInstanceRequests(&ec2.DescribeSpotInstanceRequestsInput{
SpotInstanceRequestIds: []*string{sir.SpotInstanceRequestId},
})
if ... | go | func SpotInstanceStateRefreshFunc(
conn *ec2.EC2, sir ec2.SpotInstanceRequest) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
resp, err := conn.DescribeSpotInstanceRequests(&ec2.DescribeSpotInstanceRequestsInput{
SpotInstanceRequestIds: []*string{sir.SpotInstanceRequestId},
})
if ... | [
"func",
"SpotInstanceStateRefreshFunc",
"(",
"conn",
"*",
"ec2",
".",
"EC2",
",",
"sir",
"ec2",
".",
"SpotInstanceRequest",
")",
"resource",
".",
"StateRefreshFunc",
"{",
"return",
"func",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"string",
",",
"error",
... | // SpotInstanceStateRefreshFunc returns a resource.StateRefreshFunc that is used to watch
// an EC2 spot instance request | [
"SpotInstanceStateRefreshFunc",
"returns",
"a",
"resource",
".",
"StateRefreshFunc",
"that",
"is",
"used",
"to",
"watch",
"an",
"EC2",
"spot",
"instance",
"request"
] | a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4 | https://github.com/terraform-providers/terraform-provider-aws/blob/a9d2f6dddcb2fcae97cfd9c1ffba6e7d248d7db4/aws/resource_aws_spot_instance_request.go#L409-L436 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.