-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathclient.go
4339 lines (3602 loc) · 128 KB
/
client.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
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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Package client provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/deepmap/oapi-codegen version v1.15.0 DO NOT EDIT.
package client
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"strings"
"time"
"github.com/oapi-codegen/runtime"
openapi_types "github.com/oapi-codegen/runtime/types"
)
const (
BearerAuthScopes = "bearerAuth.Scopes"
)
// Defines values for AnalyticsFieldType.
const (
Boolean AnalyticsFieldType = "boolean"
Number AnalyticsFieldType = "number"
Other AnalyticsFieldType = "other"
String AnalyticsFieldType = "string"
Time AnalyticsFieldType = "time"
)
// Defines values for DeploymentStatus.
const (
DeploymentStatusFailed DeploymentStatus = "failed"
DeploymentStatusPending DeploymentStatus = "pending"
DeploymentStatusSuccess DeploymentStatus = "success"
)
// Defines values for Encoding.
const (
Base64 Encoding = "base64"
Utf8 Encoding = "utf-8"
)
// Defines values for FileAssetKind.
const (
FileAssetKindFile FileAssetKind = "file"
)
// Defines values for LogLevel.
const (
Debug LogLevel = "debug"
Error LogLevel = "error"
Info LogLevel = "info"
Warning LogLevel = "warning"
)
// Defines values for LogOrder.
const (
TimeAsc LogOrder = "timeAsc"
TimeDesc LogOrder = "timeDesc"
)
// Defines values for ProvisioningStatusFailedCode.
const (
ProvisioningStatusFailedCodeFailed ProvisioningStatusFailedCode = "failed"
)
// Defines values for ProvisioningStatusManualCode.
const (
Manual ProvisioningStatusManualCode = "manual"
)
// Defines values for ProvisioningStatusPendingCode.
const (
Pending ProvisioningStatusPendingCode = "pending"
)
// Defines values for ProvisioningStatusSuccessCode.
const (
Success ProvisioningStatusSuccessCode = "success"
)
// Defines values for Region.
const (
GcpAsiaEast1 Region = "gcp-asia-east1"
GcpAsiaEast2 Region = "gcp-asia-east2"
GcpAsiaNortheast1 Region = "gcp-asia-northeast1"
GcpAsiaNortheast2 Region = "gcp-asia-northeast2"
GcpAsiaNortheast3 Region = "gcp-asia-northeast3"
GcpAsiaSouth1 Region = "gcp-asia-south1"
GcpAsiaSouth2 Region = "gcp-asia-south2"
GcpAsiaSoutheast1 Region = "gcp-asia-southeast1"
GcpAsiaSoutheast2 Region = "gcp-asia-southeast2"
GcpAustraliaSoutheast1 Region = "gcp-australia-southeast1"
GcpAustraliaSoutheast2 Region = "gcp-australia-southeast2"
GcpEuropeCentral2 Region = "gcp-europe-central2"
GcpEuropeNorth1 Region = "gcp-europe-north1"
GcpEuropeSouthwest1 Region = "gcp-europe-southwest1"
GcpEuropeWest1 Region = "gcp-europe-west1"
GcpEuropeWest2 Region = "gcp-europe-west2"
GcpEuropeWest3 Region = "gcp-europe-west3"
GcpEuropeWest4 Region = "gcp-europe-west4"
GcpEuropeWest6 Region = "gcp-europe-west6"
GcpEuropeWest8 Region = "gcp-europe-west8"
GcpMeWest1 Region = "gcp-me-west1"
GcpNorthamericaNortheast1 Region = "gcp-northamerica-northeast1"
GcpNorthamericaNortheast2 Region = "gcp-northamerica-northeast2"
GcpSouthamericaEast1 Region = "gcp-southamerica-east1"
GcpSouthamericaWest1 Region = "gcp-southamerica-west1"
GcpUsCentral1 Region = "gcp-us-central1"
GcpUsEast1 Region = "gcp-us-east1"
GcpUsEast4 Region = "gcp-us-east4"
GcpUsEast5 Region = "gcp-us-east5"
GcpUsSouth1 Region = "gcp-us-south1"
GcpUsWest1 Region = "gcp-us-west1"
GcpUsWest2 Region = "gcp-us-west2"
GcpUsWest3 Region = "gcp-us-west3"
GcpUsWest4 Region = "gcp-us-west4"
)
// Defines values for SymlinkAssetKind.
const (
SymlinkAssetKindSymlink SymlinkAssetKind = "symlink"
)
// Defines values for TlsCipher.
const (
Ec TlsCipher = "ec"
Rsa TlsCipher = "rsa"
)
// AddDomainCertificateRequest defines model for AddDomainCertificateRequest.
type AddDomainCertificateRequest struct {
// CertificateChain The PRM encoded certificate chain for the TLS certificate
CertificateChain string `json:"certificateChain"`
// PrivateKey The PEM encoded private key for the TLS certificate
PrivateKey string `json:"privateKey"`
}
// Analytics Project analytics data
type Analytics struct {
Fields []AnalyticsFieldSchema `json:"fields"`
Values [][]AnalyticsDataValue `json:"values"`
}
// AnalyticsDataValue defines model for AnalyticsDataValue.
type AnalyticsDataValue struct {
union json.RawMessage
}
// AnalyticsDataValue0 defines model for .
type AnalyticsDataValue0 = time.Time
// AnalyticsDataValue1 defines model for .
type AnalyticsDataValue1 = float64
// AnalyticsDataValue2 defines model for .
type AnalyticsDataValue2 = string
// AnalyticsDataValue3 defines model for .
type AnalyticsDataValue3 = bool
// AnalyticsDataValue4 defines model for .
type AnalyticsDataValue4 = interface{}
// AnalyticsFieldSchema defines model for AnalyticsFieldSchema.
type AnalyticsFieldSchema struct {
Name string `json:"name"`
// Type A data type that analytic data can be represented in.
//
// Inspired by Grafana's data types defined at:
// https://github.com/grafana/grafana/blob/e3288834b37b9aac10c1f43f0e621b35874c1f8a/packages/grafana-data/src/types/dataFrame.ts#L11-L23
Type AnalyticsFieldType `json:"type"`
}
// AnalyticsFieldType A data type that analytic data can be represented in.
//
// Inspired by Grafana's data types defined at:
// https://github.com/grafana/grafana/blob/e3288834b37b9aac10c1f43f0e621b35874c1f8a/packages/grafana-data/src/types/dataFrame.ts#L11-L23
type AnalyticsFieldType string
// AppLogsResponseEntry defines model for AppLogsResponseEntry.
type AppLogsResponseEntry struct {
Level LogLevel `json:"level"`
Message string `json:"message"`
Region Region `json:"region"`
// Time Log timestamp
Time time.Time `json:"time"`
}
// Asset defines model for Asset.
type Asset struct {
union json.RawMessage
}
// Assets A map whose key represents a file path, and the value is an asset that
// composes the deployment.
//
// Each asset is one of the following three kinds:
//
// 1. A file with content data (which is UTF-8 for text, or base64 for binary)
// 2. A file with a hash
// 3. A symbolic link to another asset
//
// Assets that were uploaded in some of the previous deployments don't need to
// be uploaded again. In this case, in order to identify the asset, just
// provide the SHA-1 hash of the content.
type Assets map[string]Asset
// BuildLogsResponseEntry defines model for BuildLogsResponseEntry.
type BuildLogsResponseEntry struct {
Level string `json:"level"`
Message string `json:"message"`
}
// CompilerOptions Compiler options to be used when building the deployment.
//
// If `null` is given, Deno's config file (i.e. `deno.json` or `deno.jsonc`)
// will be auto-discovered, which may contain a `compilerOptions` field. If
// found, that compiler options will be applied.
//
// If an empty object `{}` is given, [the default compiler options](https://docs.deno.com/runtime/manual/advanced/typescript/configuration#how-deno-uses-a-configuration-file)
// will be applied.
type CompilerOptions struct {
Jsx *string `json:"jsx"`
JsxFactory *string `json:"jsxFactory"`
JsxFragmentFactory *string `json:"jsxFragmentFactory"`
JsxImportSource *string `json:"jsxImportSource"`
}
// CreateDeploymentRequest defines model for CreateDeploymentRequest.
type CreateDeploymentRequest struct {
// Assets A map whose key represents a file path, and the value is an asset that
// composes the deployment.
//
// Each asset is one of the following three kinds:
//
// 1. A file with content data (which is UTF-8 for text, or base64 for binary)
// 2. A file with a hash
// 3. A symbolic link to another asset
//
// Assets that were uploaded in some of the previous deployments don't need to
// be uploaded again. In this case, in order to identify the asset, just
// provide the SHA-1 hash of the content.
Assets Assets `json:"assets"`
CompilerOptions *CompilerOptions `json:"compilerOptions"`
// EntryPointUrl An URL of the entry point of the application.
// This is the file that will be executed when the deployment is invoked.
EntryPointUrl string `json:"entryPointUrl"`
// EnvVars A dictionary of environment variables to be set in the runtime environment
// of the deployment.
EnvVars map[string]string `json:"envVars"`
// ImportMapUrl An URL of the import map file.
//
// If `null` is given, import map auto-discovery logic will be performed,
// where it looks for Deno's config file (i.e. `deno.json` or `deno.jsonc`)
// which may contain an embedded import map or a path to an import map file.
// If found, that import map will be used.
//
// If an empty string is given, no import map will be used.
ImportMapUrl *string `json:"importMapUrl"`
// LockFileUrl An URL of the lock file.
//
// If `null` is given, lock file auto-discovery logic will be performed,
// where it looks for Deno's config file (i.e. `deno.json` or `deno.jsonc`)
// which may contain a path to a lock file or boolean value, such as `"lock":
// false` or `"lock": "my-lock.lock"`. If a config file is found, the
// semantics of the lock field is the same as the Deno CLI, so refer to [the
// CLI doc page](https://docs.deno.com/runtime/manual/basics/modules/integrity_checking#auto-generated-lockfile).
//
// If an empty string is given, no lock file will be used.
LockFileUrl *string `json:"lockFileUrl"`
}
// CreateDomainRequest defines model for CreateDomainRequest.
type CreateDomainRequest struct {
Domain string `json:"domain"`
}
// CreateProjectRequest defines model for CreateProjectRequest.
type CreateProjectRequest struct {
// Name The name of the project. If this is `null`, a random name will be
// generated.
Name *string `json:"name"`
}
// CursorLinkHeader Pagination links.
// This header provides a URL for the `next` page.
// The format conforms to [RFC 8288](https://tools.ietf.org/html/rfc8288).
type CursorLinkHeader = string
// Deployment defines model for Deployment.
type Deployment struct {
CreatedAt time.Time `json:"createdAt"`
Domains *[]string `json:"domains"`
// Id A deployment ID
//
// Note that this is not UUID v4, as opposed to organization ID and project ID.
Id DeploymentId `json:"id"`
ProjectId openapi_types.UUID `json:"projectId"`
// Status The status of a deployment.
Status DeploymentStatus `json:"status"`
UpdatedAt time.Time `json:"updatedAt"`
}
// DeploymentId A deployment ID
//
// Note that this is not UUID v4, as opposed to organization ID and project ID.
type DeploymentId = string
// DeploymentStatus The status of a deployment.
type DeploymentStatus string
// DnsRecord defines model for DnsRecord.
type DnsRecord struct {
Content string `json:"content"`
Name string `json:"name"`
Type string `json:"type"`
}
// Domain defines model for Domain.
type Domain struct {
// Certificates TLS certificates for the domain.
Certificates []DomainCertificate `json:"certificates"`
CreatedAt time.Time `json:"createdAt"`
// DnsRecords These records are used to verify the ownership of the domain.
DnsRecords []DnsRecord `json:"dnsRecords"`
// Domain The domain value.
Domain string `json:"domain"`
// Id The ID of the domain.
Id openapi_types.UUID `json:"id"`
// IsValidated Whether the domain's ownership is validated or not.
IsValidated bool `json:"isValidated"`
// OrganizationId The ID of the organization that the domain is associated with.
OrganizationId openapi_types.UUID `json:"organizationId"`
// ProjectId The ID of the project that the domain is associated with.
//
// If the domain is not associated with any project, this field is omitted.
ProjectId *openapi_types.UUID `json:"projectId"`
ProvisioningStatus ProvisioningStatus `json:"provisioningStatus"`
Token string `json:"token"`
UpdatedAt time.Time `json:"updatedAt"`
}
// DomainCertificate defines model for DomainCertificate.
type DomainCertificate struct {
Cipher TlsCipher `json:"cipher"`
CreatedAt time.Time `json:"createdAt"`
ExpiresAt time.Time `json:"expiresAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
// Encoding defines model for Encoding.
type Encoding string
// ErrorBody defines model for ErrorBody.
type ErrorBody struct {
// Code The error code
Code string `json:"code"`
// Message The error message
Message string `json:"message"`
}
// File defines model for File.
type File struct {
union json.RawMessage
}
// File0 defines model for .
type File0 struct {
Content string `json:"content"`
Encoding *Encoding `json:"encoding,omitempty"`
}
// File1 defines model for .
type File1 struct {
GitSha1 string `json:"gitSha1"`
}
// FileAsset defines model for FileAsset.
type FileAsset struct {
Kind FileAssetKind `json:"kind"`
union json.RawMessage
}
// FileAssetKind defines model for FileAsset.Kind.
type FileAssetKind string
// FileAsset0 defines model for .
type FileAsset0 struct {
Content string `json:"content"`
Encoding *Encoding `json:"encoding,omitempty"`
}
// FileAsset1 defines model for .
type FileAsset1 struct {
GitSha1 string `json:"gitSha1"`
}
// LogLevel defines model for LogLevel.
type LogLevel string
// LogOrder defines model for LogOrder.
type LogOrder string
// Organization defines model for Organization.
type Organization struct {
CreatedAt time.Time `json:"createdAt"`
Id openapi_types.UUID `json:"id"`
Name string `json:"name"`
UpdatedAt time.Time `json:"updatedAt"`
}
// PaginationLinkHeader Pagination links.
// This header provides URLS for the `prev`, `next`, `first`, and `last` pages.
// The format conforms to [RFC 8288](https://tools.ietf.org/html/rfc8288).
type PaginationLinkHeader = string
// Project defines model for Project.
type Project struct {
CreatedAt time.Time `json:"createdAt"`
Id openapi_types.UUID `json:"id"`
Name string `json:"name"`
UpdatedAt time.Time `json:"updatedAt"`
}
// ProvisioningStatus defines model for ProvisioningStatus.
type ProvisioningStatus struct {
union json.RawMessage
}
// ProvisioningStatusFailed defines model for ProvisioningStatusFailed.
type ProvisioningStatusFailed struct {
Code ProvisioningStatusFailedCode `json:"code"`
Message string `json:"message"`
}
// ProvisioningStatusFailedCode defines model for ProvisioningStatusFailed.Code.
type ProvisioningStatusFailedCode string
// ProvisioningStatusManual defines model for ProvisioningStatusManual.
type ProvisioningStatusManual struct {
Code ProvisioningStatusManualCode `json:"code"`
}
// ProvisioningStatusManualCode defines model for ProvisioningStatusManual.Code.
type ProvisioningStatusManualCode string
// ProvisioningStatusPending defines model for ProvisioningStatusPending.
type ProvisioningStatusPending struct {
Code ProvisioningStatusPendingCode `json:"code"`
}
// ProvisioningStatusPendingCode defines model for ProvisioningStatusPending.Code.
type ProvisioningStatusPendingCode string
// ProvisioningStatusSuccess defines model for ProvisioningStatusSuccess.
type ProvisioningStatusSuccess struct {
Code ProvisioningStatusSuccessCode `json:"code"`
}
// ProvisioningStatusSuccessCode defines model for ProvisioningStatusSuccess.Code.
type ProvisioningStatusSuccessCode string
// Region defines model for Region.
type Region string
// Symlink defines model for Symlink.
type Symlink struct {
Target string `json:"target"`
}
// SymlinkAsset defines model for SymlinkAsset.
type SymlinkAsset struct {
Kind SymlinkAssetKind `json:"kind"`
Target string `json:"target"`
}
// SymlinkAssetKind defines model for SymlinkAsset.Kind.
type SymlinkAssetKind string
// TlsCipher defines model for TlsCipher.
type TlsCipher string
// UpdateDomainAssociationRequest defines model for UpdateDomainAssociationRequest.
type UpdateDomainAssociationRequest struct {
DeploymentId *DeploymentId `json:"deploymentId"`
}
// UpdateProjectRequest defines model for UpdateProjectRequest.
type UpdateProjectRequest struct {
Name string `json:"name"`
}
// GetAppLogsParams defines parameters for GetAppLogs.
type GetAppLogsParams struct {
// Q Text to search for in log message.
Q *string `form:"q,omitempty" json:"q,omitempty"`
// Level Log level(s) to filter logs by.
//
// Defaults to all levels (i.e. no filter applied).
//
// Multiple levels can be specified using comma-separated format.
Level *LogLevel `form:"level,omitempty" json:"level,omitempty"`
// Region Region(s) to filter logs by.
//
// Defaults to all regions (i.e. no filter applied).
//
// Multiple regions can be specified using comma-separated format.
Region *Region `form:"region,omitempty" json:"region,omitempty"`
// Since Start time of the time range to filter logs by.
//
// Defaults to the Unix Epoch (though the log retention period is 2 weeks as
// of now).
//
// If neither `since` nor `until` is specified, real-time logs are returned.
Since *time.Time `form:"since,omitempty" json:"since,omitempty"`
// Until End time of the time range to filter logs by.
//
// Defaults to the current time.
//
// If neither `since` nor `until` is specified, real-time logs are returned.
Until *time.Time `form:"until,omitempty" json:"until,omitempty"`
// Limit Maximum number of logs to return in one request.
//
// This is only effective for the past log mode.
Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
// Order Order of logs to return.
Order *LogOrder `form:"order,omitempty" json:"order,omitempty"`
// Cursor Opaque value that represents the cursor of the last log returned in the
// previous request.
//
// This is only effective for the past log mode.
Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"`
}
// ListDomainsParams defines parameters for ListDomains.
type ListDomainsParams struct {
Page *int `form:"page,omitempty" json:"page,omitempty"`
Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
}
// ListProjectsParams defines parameters for ListProjects.
type ListProjectsParams struct {
Page *int `form:"page,omitempty" json:"page,omitempty"`
Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
}
// ListDeploymentsParams defines parameters for ListDeployments.
type ListDeploymentsParams struct {
Page *int `form:"page,omitempty" json:"page,omitempty"`
Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
}
// UpdateDomainAssociationJSONRequestBody defines body for UpdateDomainAssociation for application/json ContentType.
type UpdateDomainAssociationJSONRequestBody = UpdateDomainAssociationRequest
// AddDomainCertificateJSONRequestBody defines body for AddDomainCertificate for application/json ContentType.
type AddDomainCertificateJSONRequestBody = AddDomainCertificateRequest
// CreateDomainJSONRequestBody defines body for CreateDomain for application/json ContentType.
type CreateDomainJSONRequestBody = CreateDomainRequest
// CreateProjectJSONRequestBody defines body for CreateProject for application/json ContentType.
type CreateProjectJSONRequestBody = CreateProjectRequest
// UpdateProjectJSONRequestBody defines body for UpdateProject for application/json ContentType.
type UpdateProjectJSONRequestBody = UpdateProjectRequest
// CreateDeploymentJSONRequestBody defines body for CreateDeployment for application/json ContentType.
type CreateDeploymentJSONRequestBody = CreateDeploymentRequest
// AsAnalyticsDataValue0 returns the union data inside the AnalyticsDataValue as a AnalyticsDataValue0
func (t AnalyticsDataValue) AsAnalyticsDataValue0() (AnalyticsDataValue0, error) {
var body AnalyticsDataValue0
err := json.Unmarshal(t.union, &body)
return body, err
}
// FromAnalyticsDataValue0 overwrites any union data inside the AnalyticsDataValue as the provided AnalyticsDataValue0
func (t *AnalyticsDataValue) FromAnalyticsDataValue0(v AnalyticsDataValue0) error {
b, err := json.Marshal(v)
t.union = b
return err
}
// MergeAnalyticsDataValue0 performs a merge with any union data inside the AnalyticsDataValue, using the provided AnalyticsDataValue0
func (t *AnalyticsDataValue) MergeAnalyticsDataValue0(v AnalyticsDataValue0) error {
b, err := json.Marshal(v)
if err != nil {
return err
}
merged, err := runtime.JsonMerge(t.union, b)
t.union = merged
return err
}
// AsAnalyticsDataValue1 returns the union data inside the AnalyticsDataValue as a AnalyticsDataValue1
func (t AnalyticsDataValue) AsAnalyticsDataValue1() (AnalyticsDataValue1, error) {
var body AnalyticsDataValue1
err := json.Unmarshal(t.union, &body)
return body, err
}
// FromAnalyticsDataValue1 overwrites any union data inside the AnalyticsDataValue as the provided AnalyticsDataValue1
func (t *AnalyticsDataValue) FromAnalyticsDataValue1(v AnalyticsDataValue1) error {
b, err := json.Marshal(v)
t.union = b
return err
}
// MergeAnalyticsDataValue1 performs a merge with any union data inside the AnalyticsDataValue, using the provided AnalyticsDataValue1
func (t *AnalyticsDataValue) MergeAnalyticsDataValue1(v AnalyticsDataValue1) error {
b, err := json.Marshal(v)
if err != nil {
return err
}
merged, err := runtime.JsonMerge(t.union, b)
t.union = merged
return err
}
// AsAnalyticsDataValue2 returns the union data inside the AnalyticsDataValue as a AnalyticsDataValue2
func (t AnalyticsDataValue) AsAnalyticsDataValue2() (AnalyticsDataValue2, error) {
var body AnalyticsDataValue2
err := json.Unmarshal(t.union, &body)
return body, err
}
// FromAnalyticsDataValue2 overwrites any union data inside the AnalyticsDataValue as the provided AnalyticsDataValue2
func (t *AnalyticsDataValue) FromAnalyticsDataValue2(v AnalyticsDataValue2) error {
b, err := json.Marshal(v)
t.union = b
return err
}
// MergeAnalyticsDataValue2 performs a merge with any union data inside the AnalyticsDataValue, using the provided AnalyticsDataValue2
func (t *AnalyticsDataValue) MergeAnalyticsDataValue2(v AnalyticsDataValue2) error {
b, err := json.Marshal(v)
if err != nil {
return err
}
merged, err := runtime.JsonMerge(t.union, b)
t.union = merged
return err
}
// AsAnalyticsDataValue3 returns the union data inside the AnalyticsDataValue as a AnalyticsDataValue3
func (t AnalyticsDataValue) AsAnalyticsDataValue3() (AnalyticsDataValue3, error) {
var body AnalyticsDataValue3
err := json.Unmarshal(t.union, &body)
return body, err
}
// FromAnalyticsDataValue3 overwrites any union data inside the AnalyticsDataValue as the provided AnalyticsDataValue3
func (t *AnalyticsDataValue) FromAnalyticsDataValue3(v AnalyticsDataValue3) error {
b, err := json.Marshal(v)
t.union = b
return err
}
// MergeAnalyticsDataValue3 performs a merge with any union data inside the AnalyticsDataValue, using the provided AnalyticsDataValue3
func (t *AnalyticsDataValue) MergeAnalyticsDataValue3(v AnalyticsDataValue3) error {
b, err := json.Marshal(v)
if err != nil {
return err
}
merged, err := runtime.JsonMerge(t.union, b)
t.union = merged
return err
}
// AsAnalyticsDataValue4 returns the union data inside the AnalyticsDataValue as a AnalyticsDataValue4
func (t AnalyticsDataValue) AsAnalyticsDataValue4() (AnalyticsDataValue4, error) {
var body AnalyticsDataValue4
err := json.Unmarshal(t.union, &body)
return body, err
}
// FromAnalyticsDataValue4 overwrites any union data inside the AnalyticsDataValue as the provided AnalyticsDataValue4
func (t *AnalyticsDataValue) FromAnalyticsDataValue4(v AnalyticsDataValue4) error {
b, err := json.Marshal(v)
t.union = b
return err
}
// MergeAnalyticsDataValue4 performs a merge with any union data inside the AnalyticsDataValue, using the provided AnalyticsDataValue4
func (t *AnalyticsDataValue) MergeAnalyticsDataValue4(v AnalyticsDataValue4) error {
b, err := json.Marshal(v)
if err != nil {
return err
}
merged, err := runtime.JsonMerge(t.union, b)
t.union = merged
return err
}
func (t AnalyticsDataValue) MarshalJSON() ([]byte, error) {
b, err := t.union.MarshalJSON()
return b, err
}
func (t *AnalyticsDataValue) UnmarshalJSON(b []byte) error {
err := t.union.UnmarshalJSON(b)
return err
}
// AsFileAsset returns the union data inside the Asset as a FileAsset
func (t Asset) AsFileAsset() (FileAsset, error) {
var body FileAsset
err := json.Unmarshal(t.union, &body)
return body, err
}
// FromFileAsset overwrites any union data inside the Asset as the provided FileAsset
func (t *Asset) FromFileAsset(v FileAsset) error {
v.Kind = "file"
b, err := json.Marshal(v)
t.union = b
return err
}
// MergeFileAsset performs a merge with any union data inside the Asset, using the provided FileAsset
func (t *Asset) MergeFileAsset(v FileAsset) error {
v.Kind = "file"
b, err := json.Marshal(v)
if err != nil {
return err
}
merged, err := runtime.JsonMerge(t.union, b)
t.union = merged
return err
}
// AsSymlinkAsset returns the union data inside the Asset as a SymlinkAsset
func (t Asset) AsSymlinkAsset() (SymlinkAsset, error) {
var body SymlinkAsset
err := json.Unmarshal(t.union, &body)
return body, err
}
// FromSymlinkAsset overwrites any union data inside the Asset as the provided SymlinkAsset
func (t *Asset) FromSymlinkAsset(v SymlinkAsset) error {
v.Kind = "symlink"
b, err := json.Marshal(v)
t.union = b
return err
}
// MergeSymlinkAsset performs a merge with any union data inside the Asset, using the provided SymlinkAsset
func (t *Asset) MergeSymlinkAsset(v SymlinkAsset) error {
v.Kind = "symlink"
b, err := json.Marshal(v)
if err != nil {
return err
}
merged, err := runtime.JsonMerge(t.union, b)
t.union = merged
return err
}
func (t Asset) Discriminator() (string, error) {
var discriminator struct {
Discriminator string `json:"kind"`
}
err := json.Unmarshal(t.union, &discriminator)
return discriminator.Discriminator, err
}
func (t Asset) ValueByDiscriminator() (interface{}, error) {
discriminator, err := t.Discriminator()
if err != nil {
return nil, err
}
switch discriminator {
case "file":
return t.AsFileAsset()
case "symlink":
return t.AsSymlinkAsset()
default:
return nil, errors.New("unknown discriminator value: " + discriminator)
}
}
func (t Asset) MarshalJSON() ([]byte, error) {
b, err := t.union.MarshalJSON()
return b, err
}
func (t *Asset) UnmarshalJSON(b []byte) error {
err := t.union.UnmarshalJSON(b)
return err
}
// AsFile0 returns the union data inside the File as a File0
func (t File) AsFile0() (File0, error) {
var body File0
err := json.Unmarshal(t.union, &body)
return body, err
}
// FromFile0 overwrites any union data inside the File as the provided File0
func (t *File) FromFile0(v File0) error {
b, err := json.Marshal(v)
t.union = b
return err
}
// MergeFile0 performs a merge with any union data inside the File, using the provided File0
func (t *File) MergeFile0(v File0) error {
b, err := json.Marshal(v)
if err != nil {
return err
}
merged, err := runtime.JsonMerge(t.union, b)
t.union = merged
return err
}
// AsFile1 returns the union data inside the File as a File1
func (t File) AsFile1() (File1, error) {
var body File1
err := json.Unmarshal(t.union, &body)
return body, err
}
// FromFile1 overwrites any union data inside the File as the provided File1
func (t *File) FromFile1(v File1) error {
b, err := json.Marshal(v)
t.union = b
return err
}
// MergeFile1 performs a merge with any union data inside the File, using the provided File1
func (t *File) MergeFile1(v File1) error {
b, err := json.Marshal(v)
if err != nil {
return err
}
merged, err := runtime.JsonMerge(t.union, b)
t.union = merged
return err
}
func (t File) MarshalJSON() ([]byte, error) {
b, err := t.union.MarshalJSON()
return b, err
}
func (t *File) UnmarshalJSON(b []byte) error {
err := t.union.UnmarshalJSON(b)
return err
}
// AsFileAsset0 returns the union data inside the FileAsset as a FileAsset0
func (t FileAsset) AsFileAsset0() (FileAsset0, error) {
var body FileAsset0
err := json.Unmarshal(t.union, &body)
return body, err
}
// FromFileAsset0 overwrites any union data inside the FileAsset as the provided FileAsset0
func (t *FileAsset) FromFileAsset0(v FileAsset0) error {
b, err := json.Marshal(v)
t.union = b
return err
}
// MergeFileAsset0 performs a merge with any union data inside the FileAsset, using the provided FileAsset0
func (t *FileAsset) MergeFileAsset0(v FileAsset0) error {
b, err := json.Marshal(v)
if err != nil {
return err
}
merged, err := runtime.JsonMerge(t.union, b)
t.union = merged
return err
}
// AsFileAsset1 returns the union data inside the FileAsset as a FileAsset1
func (t FileAsset) AsFileAsset1() (FileAsset1, error) {
var body FileAsset1
err := json.Unmarshal(t.union, &body)
return body, err
}
// FromFileAsset1 overwrites any union data inside the FileAsset as the provided FileAsset1
func (t *FileAsset) FromFileAsset1(v FileAsset1) error {
b, err := json.Marshal(v)
t.union = b
return err
}
// MergeFileAsset1 performs a merge with any union data inside the FileAsset, using the provided FileAsset1
func (t *FileAsset) MergeFileAsset1(v FileAsset1) error {
b, err := json.Marshal(v)
if err != nil {
return err
}
merged, err := runtime.JsonMerge(t.union, b)
t.union = merged
return err
}
func (t FileAsset) MarshalJSON() ([]byte, error) {
b, err := t.union.MarshalJSON()
if err != nil {
return nil, err
}
object := make(map[string]json.RawMessage)
if t.union != nil {
err = json.Unmarshal(b, &object)
if err != nil {
return nil, err
}
}
object["kind"], err = json.Marshal(t.Kind)
if err != nil {
return nil, fmt.Errorf("error marshaling 'kind': %w", err)
}
b, err = json.Marshal(object)
return b, err
}
func (t *FileAsset) UnmarshalJSON(b []byte) error {
err := t.union.UnmarshalJSON(b)
if err != nil {
return err
}
object := make(map[string]json.RawMessage)
err = json.Unmarshal(b, &object)
if err != nil {
return err
}
if raw, found := object["kind"]; found {
err = json.Unmarshal(raw, &t.Kind)
if err != nil {
return fmt.Errorf("error reading 'kind': %w", err)
}
}
return err
}
// AsProvisioningStatusSuccess returns the union data inside the ProvisioningStatus as a ProvisioningStatusSuccess
func (t ProvisioningStatus) AsProvisioningStatusSuccess() (ProvisioningStatusSuccess, error) {
var body ProvisioningStatusSuccess
err := json.Unmarshal(t.union, &body)
return body, err
}
// FromProvisioningStatusSuccess overwrites any union data inside the ProvisioningStatus as the provided ProvisioningStatusSuccess
func (t *ProvisioningStatus) FromProvisioningStatusSuccess(v ProvisioningStatusSuccess) error {
v.Code = "success"
b, err := json.Marshal(v)
t.union = b
return err
}