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/registry/response | |
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/registry/response')
3 files changed, 139 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/registry/response/provider.go b/vendor/github.com/hashicorp/terraform/registry/response/provider.go new file mode 100644 index 0000000..5e8bae3 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform/registry/response/provider.go | |||
@@ -0,0 +1,36 @@ | |||
1 | package response | ||
2 | |||
3 | import ( | ||
4 | "time" | ||
5 | ) | ||
6 | |||
7 | // Provider is the response structure with the data for a single provider | ||
8 | // version. This is just the metadata. A full provider response will be | ||
9 | // ProviderDetail. | ||
10 | type Provider struct { | ||
11 | ID string `json:"id"` | ||
12 | |||
13 | //--------------------------------------------------------------- | ||
14 | // Metadata about the overall provider. | ||
15 | |||
16 | Owner string `json:"owner"` | ||
17 | Namespace string `json:"namespace"` | ||
18 | Name string `json:"name"` | ||
19 | Version string `json:"version"` | ||
20 | Description string `json:"description"` | ||
21 | Source string `json:"source"` | ||
22 | PublishedAt time.Time `json:"published_at"` | ||
23 | Downloads int `json:"downloads"` | ||
24 | } | ||
25 | |||
26 | // ProviderDetail represents a Provider with full detail. | ||
27 | type ProviderDetail struct { | ||
28 | Provider | ||
29 | |||
30 | //--------------------------------------------------------------- | ||
31 | // The fields below are only set when requesting this specific | ||
32 | // module. They are available to easily know all available versions | ||
33 | // without multiple API calls. | ||
34 | |||
35 | Versions []string `json:"versions"` // All versions | ||
36 | } | ||
diff --git a/vendor/github.com/hashicorp/terraform/registry/response/provider_list.go b/vendor/github.com/hashicorp/terraform/registry/response/provider_list.go new file mode 100644 index 0000000..1dc7d23 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform/registry/response/provider_list.go | |||
@@ -0,0 +1,7 @@ | |||
1 | package response | ||
2 | |||
3 | // ProviderList is the response structure for a pageable list of providers. | ||
4 | type ProviderList struct { | ||
5 | Meta PaginationMeta `json:"meta"` | ||
6 | Providers []*Provider `json:"providers"` | ||
7 | } | ||
diff --git a/vendor/github.com/hashicorp/terraform/registry/response/terraform_provider.go b/vendor/github.com/hashicorp/terraform/registry/response/terraform_provider.go new file mode 100644 index 0000000..64e454a --- /dev/null +++ b/vendor/github.com/hashicorp/terraform/registry/response/terraform_provider.go | |||
@@ -0,0 +1,96 @@ | |||
1 | package response | ||
2 | |||
3 | import ( | ||
4 | "sort" | ||
5 | "strings" | ||
6 | |||
7 | version "github.com/hashicorp/go-version" | ||
8 | ) | ||
9 | |||
10 | // TerraformProvider is the response structure for all required information for | ||
11 | // Terraform to choose a download URL. It must include all versions and all | ||
12 | // platforms for Terraform to perform version and os/arch constraint matching | ||
13 | // locally. | ||
14 | type TerraformProvider struct { | ||
15 | ID string `json:"id"` | ||
16 | Verified bool `json:"verified"` | ||
17 | |||
18 | Versions []*TerraformProviderVersion `json:"versions"` | ||
19 | } | ||
20 | |||
21 | // TerraformProviderVersion is the Terraform-specific response structure for a | ||
22 | // provider version. | ||
23 | type TerraformProviderVersion struct { | ||
24 | Version string `json:"version"` | ||
25 | Protocols []string `json:"protocols"` | ||
26 | |||
27 | Platforms []*TerraformProviderPlatform `json:"platforms"` | ||
28 | } | ||
29 | |||
30 | // TerraformProviderVersions is the Terraform-specific response structure for an | ||
31 | // array of provider versions | ||
32 | type TerraformProviderVersions struct { | ||
33 | ID string `json:"id"` | ||
34 | Versions []*TerraformProviderVersion `json:"versions"` | ||
35 | Warnings []string `json:"warnings"` | ||
36 | } | ||
37 | |||
38 | // TerraformProviderPlatform is the Terraform-specific response structure for a | ||
39 | // provider platform. | ||
40 | type TerraformProviderPlatform struct { | ||
41 | OS string `json:"os"` | ||
42 | Arch string `json:"arch"` | ||
43 | } | ||
44 | |||
45 | // TerraformProviderPlatformLocation is the Terraform-specific response | ||
46 | // structure for a provider platform with all details required to perform a | ||
47 | // download. | ||
48 | type TerraformProviderPlatformLocation struct { | ||
49 | Protocols []string `json:"protocols"` | ||
50 | OS string `json:"os"` | ||
51 | Arch string `json:"arch"` | ||
52 | Filename string `json:"filename"` | ||
53 | DownloadURL string `json:"download_url"` | ||
54 | ShasumsURL string `json:"shasums_url"` | ||
55 | ShasumsSignatureURL string `json:"shasums_signature_url"` | ||
56 | Shasum string `json:"shasum"` | ||
57 | |||
58 | SigningKeys SigningKeyList `json:"signing_keys"` | ||
59 | } | ||
60 | |||
61 | // SigningKeyList is the response structure for a list of signing keys. | ||
62 | type SigningKeyList struct { | ||
63 | GPGKeys []*GPGKey `json:"gpg_public_keys"` | ||
64 | } | ||
65 | |||
66 | // GPGKey is the response structure for a GPG key. | ||
67 | type GPGKey struct { | ||
68 | ASCIIArmor string `json:"ascii_armor"` | ||
69 | Source string `json:"source"` | ||
70 | SourceURL *string `json:"source_url"` | ||
71 | } | ||
72 | |||
73 | // Collection type for TerraformProviderVersion | ||
74 | type ProviderVersionCollection []*TerraformProviderVersion | ||
75 | |||
76 | // GPGASCIIArmor returns an ASCII-armor-formatted string for all of the gpg | ||
77 | // keys in the response. | ||
78 | func (signingKeys *SigningKeyList) GPGASCIIArmor() string { | ||
79 | keys := []string{} | ||
80 | |||
81 | for _, gpgKey := range signingKeys.GPGKeys { | ||
82 | keys = append(keys, gpgKey.ASCIIArmor) | ||
83 | } | ||
84 | |||
85 | return strings.Join(keys, "\n") | ||
86 | } | ||
87 | |||
88 | // Sort sorts versions from newest to oldest. | ||
89 | func (v ProviderVersionCollection) Sort() { | ||
90 | sort.Slice(v, func(i, j int) bool { | ||
91 | versionA, _ := version.NewVersion(v[i].Version) | ||
92 | versionB, _ := version.NewVersion(v[j].Version) | ||
93 | |||
94 | return versionA.GreaterThan(versionB) | ||
95 | }) | ||
96 | } | ||