7
7
)
8
8
9
9
// Secret describes a Coder secret.
10
+ //
11
+ // Deprecated: Coder Secrets will be removed from Coder Enterprise in a future release.
10
12
type Secret struct {
11
13
ID string `json:"id" table:"-"`
12
14
Name string `json:"name" table:"Name"`
@@ -17,7 +19,9 @@ type Secret struct {
17
19
}
18
20
19
21
// Secrets gets all secrets for the given user.
20
- func (c * Client ) Secrets (ctx context.Context , userID string ) ([]Secret , error ) {
22
+ //
23
+ // Deprecated: Coder Secrets will be removed from Coder Enterprise in a future release.
24
+ func (c Client ) Secrets (ctx context.Context , userID string ) ([]Secret , error ) {
21
25
var secrets []Secret
22
26
if err := c .requestBody (ctx , http .MethodGet , "/api/users/" + userID + "/secrets" , nil , & secrets ); err != nil {
23
27
return nil , err
@@ -26,7 +30,9 @@ func (c *Client) Secrets(ctx context.Context, userID string) ([]Secret, error) {
26
30
}
27
31
28
32
// SecretWithValueByName gets the Coder secret with its value by its name.
29
- func (c * Client ) SecretWithValueByName (ctx context.Context , name , userID string ) (* Secret , error ) {
33
+ //
34
+ // Deprecated: Coder Secrets will be removed from Coder Enterprise in a future release.
35
+ func (c Client ) SecretWithValueByName (ctx context.Context , name , userID string ) (* Secret , error ) {
30
36
// Lookup the secret from the name.
31
37
s , err := c .SecretByName (ctx , name , userID )
32
38
if err != nil {
@@ -43,7 +49,9 @@ func (c *Client) SecretWithValueByName(ctx context.Context, name, userID string)
43
49
}
44
50
45
51
// SecretWithValueByID gets the Coder secret with its value by the secret_id.
46
- func (c * Client ) SecretWithValueByID (ctx context.Context , id , userID string ) (* Secret , error ) {
52
+ //
53
+ // Deprecated: Coder Secrets will be removed from Coder Enterprise in a future release.
54
+ func (c Client ) SecretWithValueByID (ctx context.Context , id , userID string ) (* Secret , error ) {
47
55
var secret Secret
48
56
if err := c .requestBody (ctx , http .MethodGet , "/api/users/" + userID + "/secrets/" + id , nil , & secret ); err != nil {
49
57
return nil , err
@@ -52,7 +60,9 @@ func (c *Client) SecretWithValueByID(ctx context.Context, id, userID string) (*S
52
60
}
53
61
54
62
// SecretByName gets a secret object by name.
55
- func (c * Client ) SecretByName (ctx context.Context , name , userID string ) (* Secret , error ) {
63
+ //
64
+ // Deprecated: Coder Secrets will be removed from Coder Enterprise in a future release.
65
+ func (c Client ) SecretByName (ctx context.Context , name , userID string ) (* Secret , error ) {
56
66
secrets , err := c .Secrets (ctx , userID )
57
67
if err != nil {
58
68
return nil , err
@@ -66,19 +76,25 @@ func (c *Client) SecretByName(ctx context.Context, name, userID string) (*Secret
66
76
}
67
77
68
78
// InsertSecretReq describes the request body for creating a new secret.
79
+ //
80
+ // Deprecated: Coder Secrets will be removed from Coder Enterprise in a future release.
69
81
type InsertSecretReq struct {
70
82
Name string `json:"name"`
71
83
Value string `json:"value"`
72
84
Description string `json:"description"`
73
85
}
74
86
75
87
// InsertSecret adds a new secret for the authed user.
76
- func (c * Client ) InsertSecret (ctx context.Context , user * User , req InsertSecretReq ) error {
77
- return c .requestBody (ctx , http .MethodPost , "/api/users/" + user .ID + "/secrets" , req , nil )
88
+ //
89
+ // Deprecated: Coder Secrets will be removed from Coder Enterprise in a future release.
90
+ func (c Client ) InsertSecret (ctx context.Context , userID string , req InsertSecretReq ) error {
91
+ return c .requestBody (ctx , http .MethodPost , "/api/users/" + userID + "/secrets" , req , nil )
78
92
}
79
93
80
94
// DeleteSecretByName deletes the authenticated users secret with the given name.
81
- func (c * Client ) DeleteSecretByName (ctx context.Context , name , userID string ) error {
95
+ //
96
+ // Deprecated: Coder Secrets will be removed from Coder Enterprise in a future release.
97
+ func (c Client ) DeleteSecretByName (ctx context.Context , name , userID string ) error {
82
98
// Lookup the secret by name to get the ID.
83
99
secret , err := c .SecretByName (ctx , name , userID )
84
100
if err != nil {
0 commit comments