Skip to content

Commit d9177eb

Browse files
authored
Merge pull request #15 from zeropsio/z0-project-user-only
sdk update
2 parents 2acd248 + f00711e commit d9177eb

File tree

74 files changed

+2365
-280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2365
-280
lines changed

dto/input/body/esTransactionDebitGroupBy.go renamed to dto/input/body/esGroupBySearch.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,67 +12,67 @@ import (
1212
)
1313

1414
var _ strconv.NumError
15-
var _ json.Unmarshaler = (*EsTransactionDebitGroupBy)(nil)
15+
var _ json.Unmarshaler = (*EsGroupBySearch)(nil)
1616

17-
type EsTransactionDebitGroupBy struct {
18-
Search EsTransactionDebitGroupBySearch `json:"search"`
19-
From types.DateTime `json:"from"`
20-
Till types.DateTime `json:"till"`
21-
TimeZone types.String `json:"timeZone"`
22-
SubscriptionName types.StringNull `json:"subscriptionName"`
23-
ReceiverId types.StringNull `json:"receiverId"`
24-
GroupBy enum.EsTransactionDebitGroupByEnum `json:"groupBy"`
25-
TimeGroupBy types.String `json:"timeGroupBy"`
17+
type EsGroupBySearch struct {
18+
Search EsGroupBySearchSearch `json:"search"`
19+
From types.DateTime `json:"from"`
20+
Till types.DateTime `json:"till"`
21+
TimeZone types.String `json:"timeZone"`
22+
SubscriptionName types.StringNull `json:"subscriptionName"`
23+
ReceiverId types.StringNull `json:"receiverId"`
24+
GroupBy enum.EsGroupBySearchGroupByEnum `json:"groupBy"`
25+
TimeGroupBy types.String `json:"timeGroupBy"`
2626
}
2727

28-
func (dto EsTransactionDebitGroupBy) GetSearch() EsTransactionDebitGroupBySearch {
28+
func (dto EsGroupBySearch) GetSearch() EsGroupBySearchSearch {
2929
return dto.Search
3030
}
31-
func (dto EsTransactionDebitGroupBy) GetFrom() types.DateTime {
31+
func (dto EsGroupBySearch) GetFrom() types.DateTime {
3232
return dto.From
3333
}
34-
func (dto EsTransactionDebitGroupBy) GetTill() types.DateTime {
34+
func (dto EsGroupBySearch) GetTill() types.DateTime {
3535
return dto.Till
3636
}
37-
func (dto EsTransactionDebitGroupBy) GetTimeZone() types.String {
37+
func (dto EsGroupBySearch) GetTimeZone() types.String {
3838
return dto.TimeZone
3939
}
40-
func (dto EsTransactionDebitGroupBy) GetSubscriptionName() types.StringNull {
40+
func (dto EsGroupBySearch) GetSubscriptionName() types.StringNull {
4141
return dto.SubscriptionName
4242
}
43-
func (dto EsTransactionDebitGroupBy) GetReceiverId() types.StringNull {
43+
func (dto EsGroupBySearch) GetReceiverId() types.StringNull {
4444
return dto.ReceiverId
4545
}
46-
func (dto EsTransactionDebitGroupBy) GetGroupBy() enum.EsTransactionDebitGroupByEnum {
46+
func (dto EsGroupBySearch) GetGroupBy() enum.EsGroupBySearchGroupByEnum {
4747
return dto.GroupBy
4848
}
49-
func (dto EsTransactionDebitGroupBy) GetTimeGroupBy() types.String {
49+
func (dto EsGroupBySearch) GetTimeGroupBy() types.String {
5050
return dto.TimeGroupBy
5151
}
5252

53-
type EsTransactionDebitGroupBySearch []EsSearchItem
53+
type EsGroupBySearchSearch []EsSearchItem
5454

55-
func (dto EsTransactionDebitGroupBySearch) MarshalJSON() ([]byte, error) {
55+
func (dto EsGroupBySearchSearch) MarshalJSON() ([]byte, error) {
5656
if dto == nil {
5757
return []byte("[]"), nil
5858
}
5959
return json.Marshal([]EsSearchItem(dto))
6060
}
6161

62-
func (dto *EsTransactionDebitGroupBy) UnmarshalJSON(b []byte) error {
62+
func (dto *EsGroupBySearch) UnmarshalJSON(b []byte) error {
6363
var aux = struct {
64-
Search *EsTransactionDebitGroupBySearch
64+
Search *EsGroupBySearchSearch
6565
From *types.DateTime
6666
Till *types.DateTime
6767
TimeZone *types.String
6868
SubscriptionName types.StringNull
6969
ReceiverId types.StringNull
70-
GroupBy *enum.EsTransactionDebitGroupByEnum
70+
GroupBy *enum.EsGroupBySearchGroupByEnum
7171
TimeGroupBy *types.String
7272
}{}
7373
err := json.Unmarshal(b, &aux)
7474
if err != nil {
75-
return validator.JsonValidation("EsTransactionDebitGroupBy", err)
75+
return validator.JsonValidation("EsGroupBySearch", err)
7676
}
7777
var errorList validator.ErrorList
7878
if aux.Search == nil {

dto/input/body/postProject.go

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ var _ strconv.NumError
1616
var _ json.Unmarshaler = (*PostProject)(nil)
1717

1818
type PostProject struct {
19-
ClientId uuid.ClientId `json:"clientId"`
20-
Name types.String `json:"name"`
21-
Description types.TextNull `json:"description"`
22-
Mode *enum.ProjectModeEnum `json:"mode"`
23-
TagList types.StringArray `json:"tagList"`
24-
EnvVariables PostProjectEnvVariables `json:"envVariables"`
25-
EnvIsolation types.StringNull `json:"envIsolation"`
26-
SshIsolation types.StringNull `json:"sshIsolation"`
27-
MaxCreditLimit types.DecimalNull `json:"maxCreditLimit"`
19+
ClientId uuid.ClientId `json:"clientId"`
20+
Name types.String `json:"name"`
21+
Description types.TextNull `json:"description"`
22+
Mode *enum.ProjectModeEnum `json:"mode"`
23+
TagList types.StringArray `json:"tagList"`
24+
EnvVariables PostProjectEnvVariables `json:"envVariables"`
25+
PublicIpV4Shared types.Bool `json:"publicIpV4Shared"`
26+
EnvIsolation types.StringNull `json:"envIsolation"`
27+
SshIsolation types.StringNull `json:"sshIsolation"`
28+
MaxCreditLimit types.DecimalNull `json:"maxCreditLimit"`
29+
Location types.StringNull `json:"location"`
2830
}
2931

3032
func (dto PostProject) GetClientId() uuid.ClientId {
@@ -45,6 +47,9 @@ func (dto PostProject) GetTagList() types.StringArray {
4547
func (dto PostProject) GetEnvVariables() PostProjectEnvVariables {
4648
return dto.EnvVariables
4749
}
50+
func (dto PostProject) GetPublicIpV4Shared() types.Bool {
51+
return dto.PublicIpV4Shared
52+
}
4853
func (dto PostProject) GetEnvIsolation() types.StringNull {
4954
return dto.EnvIsolation
5055
}
@@ -54,6 +59,9 @@ func (dto PostProject) GetSshIsolation() types.StringNull {
5459
func (dto PostProject) GetMaxCreditLimit() types.DecimalNull {
5560
return dto.MaxCreditLimit
5661
}
62+
func (dto PostProject) GetLocation() types.StringNull {
63+
return dto.Location
64+
}
5765

5866
type PostProjectEnvVariables []ProjectEnvPut
5967

@@ -66,15 +74,17 @@ func (dto PostProjectEnvVariables) MarshalJSON() ([]byte, error) {
6674

6775
func (dto *PostProject) UnmarshalJSON(b []byte) error {
6876
var aux = struct {
69-
ClientId *uuid.ClientId
70-
Name *types.String
71-
Description types.TextNull
72-
Mode *enum.ProjectModeEnum
73-
TagList *types.StringArray
74-
EnvVariables *PostProjectEnvVariables
75-
EnvIsolation types.StringNull
76-
SshIsolation types.StringNull
77-
MaxCreditLimit types.DecimalNull
77+
ClientId *uuid.ClientId
78+
Name *types.String
79+
Description types.TextNull
80+
Mode *enum.ProjectModeEnum
81+
TagList *types.StringArray
82+
EnvVariables *PostProjectEnvVariables
83+
PublicIpV4Shared *types.Bool
84+
EnvIsolation types.StringNull
85+
SshIsolation types.StringNull
86+
MaxCreditLimit types.DecimalNull
87+
Location types.StringNull
7888
}{}
7989
err := json.Unmarshal(b, &aux)
8090
if err != nil {
@@ -93,6 +103,9 @@ func (dto *PostProject) UnmarshalJSON(b []byte) error {
93103
if aux.EnvVariables == nil {
94104
errorList = errorList.With(validator.NewError("envVariables", "field is required"))
95105
}
106+
if aux.PublicIpV4Shared == nil {
107+
errorList = errorList.With(validator.NewError("publicIpV4Shared", "field is required"))
108+
}
96109
if errorList != nil {
97110
return errorList.GetError()
98111
}
@@ -102,9 +115,11 @@ func (dto *PostProject) UnmarshalJSON(b []byte) error {
102115
dto.Mode = aux.Mode
103116
dto.TagList = *aux.TagList
104117
dto.EnvVariables = *aux.EnvVariables
118+
dto.PublicIpV4Shared = *aux.PublicIpV4Shared
105119
dto.EnvIsolation = aux.EnvIsolation
106120
dto.SshIsolation = aux.SshIsolation
107121
dto.MaxCreditLimit = aux.MaxCreditLimit
122+
dto.Location = aux.Location
108123

109124
return nil
110125
}

dto/input/body/postProjectVpn.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,29 @@ import (
77
"strconv"
88

99
"github.com/zeropsio/zerops-go/types"
10+
"github.com/zeropsio/zerops-go/types/uuid"
1011
"github.com/zeropsio/zerops-go/validator"
1112
)
1213

1314
var _ strconv.NumError
1415
var _ json.Unmarshaler = (*PostProjectVpn)(nil)
1516

1617
type PostProjectVpn struct {
17-
PublicKey types.String `json:"publicKey"`
18+
PublicKey types.String `json:"publicKey"`
19+
InstanceId uuid.InstanceIdNull `json:"instanceId"`
1820
}
1921

2022
func (dto PostProjectVpn) GetPublicKey() types.String {
2123
return dto.PublicKey
2224
}
25+
func (dto PostProjectVpn) GetInstanceId() uuid.InstanceIdNull {
26+
return dto.InstanceId
27+
}
2328

2429
func (dto *PostProjectVpn) UnmarshalJSON(b []byte) error {
2530
var aux = struct {
26-
PublicKey *types.String
31+
PublicKey *types.String
32+
InstanceId uuid.InstanceIdNull
2733
}{}
2834
err := json.Unmarshal(b, &aux)
2935
if err != nil {
@@ -37,6 +43,7 @@ func (dto *PostProjectVpn) UnmarshalJSON(b []byte) error {
3743
return errorList.GetError()
3844
}
3945
dto.PublicKey = *aux.PublicKey
46+
dto.InstanceId = aux.InstanceId
4047

4148
return nil
4249
}

dto/input/body/postStandardServiceStack.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ type PostStandardServiceStack struct {
3030
SshIsolation types.StringNull `json:"sshIsolation"`
3131
EnableSubdomainAccess types.BoolNull `json:"enableSubdomainAccess"`
3232
CdnEnabled types.BoolNull `json:"cdnEnabled"`
33+
Os types.StringNull `json:"os"`
34+
Location types.StringNull `json:"location"`
3335
}
3436

3537
func (dto PostStandardServiceStack) GetProjectId() uuid.ProjectId {
@@ -74,6 +76,12 @@ func (dto PostStandardServiceStack) GetEnableSubdomainAccess() types.BoolNull {
7476
func (dto PostStandardServiceStack) GetCdnEnabled() types.BoolNull {
7577
return dto.CdnEnabled
7678
}
79+
func (dto PostStandardServiceStack) GetOs() types.StringNull {
80+
return dto.Os
81+
}
82+
func (dto PostStandardServiceStack) GetLocation() types.StringNull {
83+
return dto.Location
84+
}
7785

7886
type PostStandardServiceStackUserData []UserDataPut
7987

@@ -100,6 +108,8 @@ func (dto *PostStandardServiceStack) UnmarshalJSON(b []byte) error {
100108
SshIsolation types.StringNull
101109
EnableSubdomainAccess types.BoolNull
102110
CdnEnabled types.BoolNull
111+
Os types.StringNull
112+
Location types.StringNull
103113
}{}
104114
err := json.Unmarshal(b, &aux)
105115
if err != nil {
@@ -132,6 +142,8 @@ func (dto *PostStandardServiceStack) UnmarshalJSON(b []byte) error {
132142
dto.SshIsolation = aux.SshIsolation
133143
dto.EnableSubdomainAccess = aux.EnableSubdomainAccess
134144
dto.CdnEnabled = aux.CdnEnabled
145+
dto.Os = aux.Os
146+
dto.Location = aux.Location
135147

136148
return nil
137149
}

dto/input/body/publicHttpRoutingLocationPost.go renamed to dto/input/body/publicHttpRoutingLocation.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,38 @@ import (
1212
)
1313

1414
var _ strconv.NumError
15-
var _ json.Unmarshaler = (*PublicHttpRoutingLocationPost)(nil)
15+
var _ json.Unmarshaler = (*PublicHttpRoutingLocation)(nil)
1616

17-
type PublicHttpRoutingLocationPost struct {
18-
Path types.String `json:"path"`
19-
Port types.Int `json:"port"`
20-
ServiceStackId uuid.ServiceStackId `json:"serviceStackId"`
17+
type PublicHttpRoutingLocation struct {
18+
Path types.String `json:"path"`
19+
Port types.Int `json:"port"`
20+
ServiceStackId uuid.ServiceStackId `json:"serviceStackId"`
21+
Config *PublicHttpRoutingLocationConfig `json:"config"`
2122
}
2223

23-
func (dto PublicHttpRoutingLocationPost) GetPath() types.String {
24+
func (dto PublicHttpRoutingLocation) GetPath() types.String {
2425
return dto.Path
2526
}
26-
func (dto PublicHttpRoutingLocationPost) GetPort() types.Int {
27+
func (dto PublicHttpRoutingLocation) GetPort() types.Int {
2728
return dto.Port
2829
}
29-
func (dto PublicHttpRoutingLocationPost) GetServiceStackId() uuid.ServiceStackId {
30+
func (dto PublicHttpRoutingLocation) GetServiceStackId() uuid.ServiceStackId {
3031
return dto.ServiceStackId
3132
}
33+
func (dto PublicHttpRoutingLocation) GetConfig() *PublicHttpRoutingLocationConfig {
34+
return dto.Config
35+
}
3236

33-
func (dto *PublicHttpRoutingLocationPost) UnmarshalJSON(b []byte) error {
37+
func (dto *PublicHttpRoutingLocation) UnmarshalJSON(b []byte) error {
3438
var aux = struct {
3539
Path *types.String
3640
Port *types.Int
3741
ServiceStackId *uuid.ServiceStackId
42+
Config *PublicHttpRoutingLocationConfig
3843
}{}
3944
err := json.Unmarshal(b, &aux)
4045
if err != nil {
41-
return validator.JsonValidation("PublicHttpRoutingLocationPost", err)
46+
return validator.JsonValidation("PublicHttpRoutingLocation", err)
4247
}
4348
var errorList validator.ErrorList
4449
if aux.Path == nil {
@@ -56,6 +61,7 @@ func (dto *PublicHttpRoutingLocationPost) UnmarshalJSON(b []byte) error {
5661
dto.Path = *aux.Path
5762
dto.Port = *aux.Port
5863
dto.ServiceStackId = *aux.ServiceStackId
64+
dto.Config = aux.Config
5965

6066
return nil
6167
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Generated ZEROPS sdk
2+
3+
package body
4+
5+
import (
6+
"encoding/json"
7+
"strconv"
8+
9+
"github.com/zeropsio/zerops-go/types"
10+
"github.com/zeropsio/zerops-go/types/enum"
11+
"github.com/zeropsio/zerops-go/validator"
12+
)
13+
14+
var _ strconv.NumError
15+
var _ json.Unmarshaler = (*PublicHttpRoutingLocationAccessPolicy)(nil)
16+
17+
type PublicHttpRoutingLocationAccessPolicy struct {
18+
Enabled types.Bool `json:"enabled"`
19+
DefaultPolicy enum.PublicHttpRoutingLocationAccessPolicyDefaultPolicyEnum `json:"defaultPolicy"`
20+
Cidr types.StringArray `json:"cidr"`
21+
}
22+
23+
func (dto PublicHttpRoutingLocationAccessPolicy) GetEnabled() types.Bool {
24+
return dto.Enabled
25+
}
26+
func (dto PublicHttpRoutingLocationAccessPolicy) GetDefaultPolicy() enum.PublicHttpRoutingLocationAccessPolicyDefaultPolicyEnum {
27+
return dto.DefaultPolicy
28+
}
29+
func (dto PublicHttpRoutingLocationAccessPolicy) GetCidr() types.StringArray {
30+
return dto.Cidr
31+
}
32+
33+
func (dto *PublicHttpRoutingLocationAccessPolicy) UnmarshalJSON(b []byte) error {
34+
var aux = struct {
35+
Enabled *types.Bool
36+
DefaultPolicy *enum.PublicHttpRoutingLocationAccessPolicyDefaultPolicyEnum
37+
Cidr *types.StringArray
38+
}{}
39+
err := json.Unmarshal(b, &aux)
40+
if err != nil {
41+
return validator.JsonValidation("PublicHttpRoutingLocationAccessPolicy", err)
42+
}
43+
var errorList validator.ErrorList
44+
if aux.Enabled == nil {
45+
errorList = errorList.With(validator.NewError("enabled", "field is required"))
46+
}
47+
if aux.DefaultPolicy == nil {
48+
errorList = errorList.With(validator.NewError("defaultPolicy", "field is required"))
49+
}
50+
if aux.Cidr == nil {
51+
errorList = errorList.With(validator.NewError("cidr", "field is required"))
52+
}
53+
if errorList != nil {
54+
return errorList.GetError()
55+
}
56+
dto.Enabled = *aux.Enabled
57+
dto.DefaultPolicy = *aux.DefaultPolicy
58+
dto.Cidr = *aux.Cidr
59+
60+
return nil
61+
}

0 commit comments

Comments
 (0)