This repository has been archived by the owner on Dec 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
/
variable_set.go
117 lines (90 loc) · 4.57 KB
/
variable_set.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package types
// VariableSet represents a Terraform Enterprise variable set.
type VariableSet struct {
ID string `jsonapi:"primary,varsets"`
Name string `jsonapi:"attribute" json:"name"`
Description string `jsonapi:"attribute" json:"description"`
Global bool `jsonapi:"attribute" json:"global"`
// Relations
Organization *Organization `jsonapi:"relationship" json:"organization"`
Workspaces []*Workspace `jsonapi:"relationship" json:"workspaces,omitempty"`
Variables []*VariableSetVariable `jsonapi:"relationship" json:"vars,omitempty"`
//Projects []*Project `jsonapi:"relationship" json:"projects,omitempty"`
}
type VariableSetVariable struct {
*Variable
// Relations
VariableSet *VariableSet `jsonapi:"relationship" json:"varset"`
}
// VariableSetCreateOptions represents the options for creating a new variable set within in a organization.
type VariableSetCreateOptions struct {
// Type is a public field utilized by JSON:API to
// set the resource type via the field tag.
// It is not a user-defined value and does not need to be set.
// https://jsonapi.org/format/#crud-creating
Type string `jsonapi:"primary,varsets"`
// The name of the variable set.
// Affects variable precedence when there are conflicts between Variable Sets
// https://developer.hashicorp.com/terraform/cloud-docs/api-docs/variable-sets#apply-variable-set-to-workspaces
Name string `jsonapi:"attribute" json:"name"`
// A description to provide context for the variable set.
Description string `jsonapi:"attribute" json:"description,omitempty"`
// If true the variable set is considered in all runs in the organization.
Global bool `jsonapi:"attribute" json:"global,omitempty"`
}
// VariableSetUpdateOptions represents the options for updating a variable set.
type VariableSetUpdateOptions struct {
// Type is a public field utilized by JSON:API to
// set the resource type via the field tag.
// It is not a user-defined value and does not need to be set.
// https://jsonapi.org/format/#crud-creating
Type string `jsonapi:"primary,varsets"`
// The name of the variable set.
// Affects variable precedence when there are conflicts between Variable Sets
// https://developer.hashicorp.com/terraform/cloud-docs/api-docs/variable-sets#apply-variable-set-to-workspaces
Name *string `jsonapi:"attribute" json:"name,omitempty"`
// A description to provide context for the variable set.
Description *string `jsonapi:"attribute" json:"description,omitempty"`
// If true the variable set is considered in all runs in the organization.
Global *bool `jsonapi:"attribute" json:"global,omitempty"`
}
// VariableSetVariableCreatOptions represents the options for creating a new variable within a variable set
type VariableSetVariableCreateOptions struct {
// Type is a public field utilized by JSON:API to
// set the resource type via the field tag.
// It is not a user-defined value and does not need to be set.
// https://jsonapi.org/format/#crud-creating
Type string `jsonapi:"primary,vars"`
// The name of the variable.
Key *string `jsonapi:"attribute" json:"key"`
// The value of the variable.
Value *string `jsonapi:"attribute" json:"value,omitempty"`
// The description of the variable.
Description *string `jsonapi:"attribute" json:"description,omitempty"`
// Whether this is a Terraform or environment variable.
Category *string `jsonapi:"attribute" json:"category"`
// Whether to evaluate the value of the variable as a string of HCL code.
HCL *bool `jsonapi:"attribute" json:"hcl,omitempty"`
// Whether the value is sensitive.
Sensitive *bool `jsonapi:"attribute" json:"sensitive,omitempty"`
}
// VariableSetVariableUpdateOptions represents the options for updating a variable.
type VariableSetVariableUpdateOptions struct {
// Type is a public field utilized by JSON:API to
// set the resource type via the field tag.
// It is not a user-defined value and does not need to be set.
// https://jsonapi.org/format/#crud-creating
Type string `jsonapi:"primary,vars"`
// The name of the variable.
Key *string `jsonapi:"attribute" json:"key,omitempty"`
// The value of the variable.
Value *string `jsonapi:"attribute" json:"value,omitempty"`
// The description of the variable.
Description *string `jsonapi:"attribute" json:"description,omitempty"`
// Whether to evaluate the value of the variable as a string of HCL code.
HCL *bool `jsonapi:"attribute" json:"hcl,omitempty"`
// Whether the value is sensitive.
Sensitive *bool `jsonapi:"attribute" json:"sensitive,omitempty"`
}