-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathorganizationcustomdomain.go
More file actions
315 lines (278 loc) · 11.4 KB
/
organizationcustomdomain.go
File metadata and controls
315 lines (278 loc) · 11.4 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package gitpod
import (
"context"
"net/http"
"slices"
"time"
"github.com/gitpod-io/gitpod-sdk-go/internal/apijson"
"github.com/gitpod-io/gitpod-sdk-go/internal/param"
"github.com/gitpod-io/gitpod-sdk-go/internal/requestconfig"
"github.com/gitpod-io/gitpod-sdk-go/option"
)
// OrganizationCustomDomainService contains methods and other services that help
// with interacting with the gitpod API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewOrganizationCustomDomainService] method instead.
type OrganizationCustomDomainService struct {
Options []option.RequestOption
}
// NewOrganizationCustomDomainService generates a new service that applies the
// given options to each request. These options are applied after the parent
// client's options (if there is one), and before any request-specific options.
func NewOrganizationCustomDomainService(opts ...option.RequestOption) (r *OrganizationCustomDomainService) {
r = &OrganizationCustomDomainService{}
r.Options = opts
return
}
// Creates a custom domain configuration for an organization.
//
// # Use this method to configure custom domains for organization workspaces
//
// ### Examples
//
// - Configure AWS custom domain:
//
// Sets up a custom domain with AWS provider.
//
// ```yaml
// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
// domainName: "workspaces.acme-corp.com"
// provider: CUSTOM_DOMAIN_PROVIDER_AWS
// awsAccountId: "123456789012"
// ```
func (r *OrganizationCustomDomainService) New(ctx context.Context, body OrganizationCustomDomainNewParams, opts ...option.RequestOption) (res *OrganizationCustomDomainNewResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "gitpod.v1.OrganizationService/CreateCustomDomain"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
// Retrieves a specific custom domain configuration.
//
// # Use this method to view custom domain details
//
// ### Examples
//
// - Get custom domain configuration:
//
// Retrieves details of a specific custom domain.
//
// ```yaml
// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
// ```
func (r *OrganizationCustomDomainService) Get(ctx context.Context, body OrganizationCustomDomainGetParams, opts ...option.RequestOption) (res *OrganizationCustomDomainGetResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "gitpod.v1.OrganizationService/GetCustomDomain"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
// Updates custom domain configuration settings.
//
// Use this method to:
//
// - Update cloud provider settings
// - Change AWS account ID
// - Modify domain configuration
//
// ### Examples
//
// - Update AWS account ID:
//
// Changes the AWS account ID for the custom domain.
//
// ```yaml
// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
// domainName: "workspaces.acme-corp.com"
// awsAccountId: "987654321098"
// ```
func (r *OrganizationCustomDomainService) Update(ctx context.Context, body OrganizationCustomDomainUpdateParams, opts ...option.RequestOption) (res *OrganizationCustomDomainUpdateResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "gitpod.v1.OrganizationService/UpdateCustomDomain"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
// Removes a custom domain configuration from an organization.
//
// Use this method to:
//
// - Disable custom domain functionality
// - Remove outdated configurations
// - Clean up unused domains
//
// ### Examples
//
// - Delete custom domain configuration:
//
// Removes a specific custom domain configuration.
//
// ```yaml
// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047"
// ```
func (r *OrganizationCustomDomainService) Delete(ctx context.Context, body OrganizationCustomDomainDeleteParams, opts ...option.RequestOption) (res *OrganizationCustomDomainDeleteResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "gitpod.v1.OrganizationService/DeleteCustomDomain"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
// CustomDomain represents a custom domain configuration for an organization
type CustomDomain struct {
// id is the unique identifier of the custom domain
ID string `json:"id" api:"required" format:"uuid"`
// created_at is when the custom domain was created
CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
// domain_name is the custom domain name
DomainName string `json:"domainName" api:"required"`
// organization_id is the ID of the organization this custom domain belongs to
OrganizationID string `json:"organizationId" api:"required" format:"uuid"`
// updated_at is when the custom domain was last updated
UpdatedAt time.Time `json:"updatedAt" api:"required" format:"date-time"`
// aws_account_id is the AWS account ID (deprecated: use cloud_account_id)
//
// Deprecated: deprecated
AwsAccountID string `json:"awsAccountId"`
// cloud_account_id is the unified cloud account identifier (AWS Account ID or GCP
// Project ID)
CloudAccountID string `json:"cloudAccountId"`
// provider is the cloud provider for this custom domain
Provider CustomDomainProvider `json:"provider"`
JSON customDomainJSON `json:"-"`
}
// customDomainJSON contains the JSON metadata for the struct [CustomDomain]
type customDomainJSON struct {
ID apijson.Field
CreatedAt apijson.Field
DomainName apijson.Field
OrganizationID apijson.Field
UpdatedAt apijson.Field
AwsAccountID apijson.Field
CloudAccountID apijson.Field
Provider apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *CustomDomain) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r customDomainJSON) RawJSON() string {
return r.raw
}
// CustomDomainProvider represents the cloud provider for custom domain
// configuration
type CustomDomainProvider string
const (
CustomDomainProviderUnspecified CustomDomainProvider = "CUSTOM_DOMAIN_PROVIDER_UNSPECIFIED"
CustomDomainProviderAws CustomDomainProvider = "CUSTOM_DOMAIN_PROVIDER_AWS"
CustomDomainProviderGcp CustomDomainProvider = "CUSTOM_DOMAIN_PROVIDER_GCP"
)
func (r CustomDomainProvider) IsKnown() bool {
switch r {
case CustomDomainProviderUnspecified, CustomDomainProviderAws, CustomDomainProviderGcp:
return true
}
return false
}
// CreateCustomDomainResponse is the response message for creating a custom domain
type OrganizationCustomDomainNewResponse struct {
// custom_domain is the created custom domain
CustomDomain CustomDomain `json:"customDomain" api:"required"`
JSON organizationCustomDomainNewResponseJSON `json:"-"`
}
// organizationCustomDomainNewResponseJSON contains the JSON metadata for the
// struct [OrganizationCustomDomainNewResponse]
type organizationCustomDomainNewResponseJSON struct {
CustomDomain apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationCustomDomainNewResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationCustomDomainNewResponseJSON) RawJSON() string {
return r.raw
}
type OrganizationCustomDomainGetResponse struct {
// CustomDomain represents a custom domain configuration for an organization
CustomDomain CustomDomain `json:"customDomain" api:"required"`
JSON organizationCustomDomainGetResponseJSON `json:"-"`
}
// organizationCustomDomainGetResponseJSON contains the JSON metadata for the
// struct [OrganizationCustomDomainGetResponse]
type organizationCustomDomainGetResponseJSON struct {
CustomDomain apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationCustomDomainGetResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationCustomDomainGetResponseJSON) RawJSON() string {
return r.raw
}
// UpdateCustomDomainResponse is the response message for updating a custom domain
type OrganizationCustomDomainUpdateResponse struct {
// custom_domain is the updated custom domain
CustomDomain CustomDomain `json:"customDomain" api:"required"`
JSON organizationCustomDomainUpdateResponseJSON `json:"-"`
}
// organizationCustomDomainUpdateResponseJSON contains the JSON metadata for the
// struct [OrganizationCustomDomainUpdateResponse]
type organizationCustomDomainUpdateResponseJSON struct {
CustomDomain apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *OrganizationCustomDomainUpdateResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r organizationCustomDomainUpdateResponseJSON) RawJSON() string {
return r.raw
}
type OrganizationCustomDomainDeleteResponse = interface{}
type OrganizationCustomDomainNewParams struct {
// domain_name is the custom domain name
DomainName param.Field[string] `json:"domainName" api:"required"`
// organization_id is the ID of the organization to create the custom domain for
OrganizationID param.Field[string] `json:"organizationId" api:"required" format:"uuid"`
// aws_account_id is the AWS account ID (deprecated: use cloud_account_id)
AwsAccountID param.Field[string] `json:"awsAccountId"`
// cloud_account_id is the unified cloud account identifier (AWS Account ID or GCP
// Project ID)
CloudAccountID param.Field[string] `json:"cloudAccountId"`
// provider is the cloud provider for this custom domain
Provider param.Field[CustomDomainProvider] `json:"provider"`
}
func (r OrganizationCustomDomainNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type OrganizationCustomDomainGetParams struct {
// organization_id is the ID of the organization to retrieve custom domain for
OrganizationID param.Field[string] `json:"organizationId" api:"required" format:"uuid"`
}
func (r OrganizationCustomDomainGetParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type OrganizationCustomDomainUpdateParams struct {
// domain_name is the custom domain name
DomainName param.Field[string] `json:"domainName" api:"required"`
// organization_id is the ID of the organization to update custom domain for
OrganizationID param.Field[string] `json:"organizationId" api:"required" format:"uuid"`
// aws_account_id is the AWS account ID (deprecated: use cloud_account_id)
AwsAccountID param.Field[string] `json:"awsAccountId"`
// cloud_account_id is the unified cloud account identifier (AWS Account ID or GCP
// Project ID)
CloudAccountID param.Field[string] `json:"cloudAccountId"`
// provider is the cloud provider for this custom domain
Provider param.Field[CustomDomainProvider] `json:"provider"`
}
func (r OrganizationCustomDomainUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type OrganizationCustomDomainDeleteParams struct {
// organization_id is the ID of the organization to delete custom domain for
OrganizationID param.Field[string] `json:"organizationId" api:"required" format:"uuid"`
}
func (r OrganizationCustomDomainDeleteParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}