diff options
author | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
---|---|---|
committer | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
commit | 107c1cdb09c575aa2f61d97f48d8587eb6bada4c (patch) | |
tree | ca7d008643efc555c388baeaf1d986e0b6b3e28c /vendor/github.com/hashicorp/terraform/providers/addressed_types.go | |
parent | 844b5a68d8af4791755b8f0ad293cc99f5959183 (diff) | |
download | terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.gz terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.zst terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.zip |
Upgrade to 0.12
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/providers/addressed_types.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/providers/addressed_types.go | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/providers/addressed_types.go b/vendor/github.com/hashicorp/terraform/providers/addressed_types.go new file mode 100644 index 0000000..7ed523f --- /dev/null +++ b/vendor/github.com/hashicorp/terraform/providers/addressed_types.go | |||
@@ -0,0 +1,47 @@ | |||
1 | package providers | ||
2 | |||
3 | import ( | ||
4 | "sort" | ||
5 | |||
6 | "github.com/hashicorp/terraform/addrs" | ||
7 | ) | ||
8 | |||
9 | // AddressedTypes is a helper that extracts all of the distinct provider | ||
10 | // types from the given list of relative provider configuration addresses. | ||
11 | func AddressedTypes(providerAddrs []addrs.ProviderConfig) []string { | ||
12 | if len(providerAddrs) == 0 { | ||
13 | return nil | ||
14 | } | ||
15 | m := map[string]struct{}{} | ||
16 | for _, addr := range providerAddrs { | ||
17 | m[addr.Type] = struct{}{} | ||
18 | } | ||
19 | |||
20 | names := make([]string, 0, len(m)) | ||
21 | for typeName := range m { | ||
22 | names = append(names, typeName) | ||
23 | } | ||
24 | |||
25 | sort.Strings(names) // Stable result for tests | ||
26 | return names | ||
27 | } | ||
28 | |||
29 | // AddressedTypesAbs is a helper that extracts all of the distinct provider | ||
30 | // types from the given list of absolute provider configuration addresses. | ||
31 | func AddressedTypesAbs(providerAddrs []addrs.AbsProviderConfig) []string { | ||
32 | if len(providerAddrs) == 0 { | ||
33 | return nil | ||
34 | } | ||
35 | m := map[string]struct{}{} | ||
36 | for _, addr := range providerAddrs { | ||
37 | m[addr.ProviderConfig.Type] = struct{}{} | ||
38 | } | ||
39 | |||
40 | names := make([]string, 0, len(m)) | ||
41 | for typeName := range m { | ||
42 | names = append(names, typeName) | ||
43 | } | ||
44 | |||
45 | sort.Strings(names) // Stable result for tests | ||
46 | return names | ||
47 | } | ||