@@ -9,53 +9,54 @@ import (
99 "net/url"
1010)
1111
12- const CONTENT_TYPE_TENANT_V4 = "application/vnd.meshcloud.api.meshtenant.v4.hal+json"
12+ const CONTENT_TYPE_TENANT_V4 = "application/vnd.meshcloud.api.meshtenant.v4-preview .hal+json"
1313
1414type MeshTenantV4 struct {
1515 ApiVersion string `json:"apiVersion" tfsdk:"api_version"`
1616 Kind string `json:"kind" tfsdk:"kind"`
17- Metadata MeshTenantMetadataV4 `json:"metadata" tfsdk:"metadata"`
18- Spec MeshTenantSpecV4 `json:"spec" tfsdk:"spec"`
19- Status MeshTenantStatusV4 `json:"status" tfsdk:"status"`
17+ Metadata MeshTenantV4Metadata `json:"metadata" tfsdk:"metadata"`
18+ Spec MeshTenantV4Spec `json:"spec" tfsdk:"spec"`
19+ Status MeshTenantV4Status `json:"status" tfsdk:"status"`
2020}
2121
22- type MeshTenantMetadataV4 struct {
23- UUID string `json:"uuid" tfsdk:"uuid"`
24- OwnedByProject string `json:"ownedByProject" tfsdk:"owned_by_project"`
25- OwnedByWorkspace string `json:"ownedByWorkspace" tfsdk:"owned_by_workspace"`
26- DeletedOn * string `json:"deletedOn" tfsdk:"deleted_on"`
27- CreatedOn * string `json:"createdOn" tfsdk:"created_on"`
22+ type MeshTenantV4Metadata struct {
23+ Uuid string `json:"uuid" tfsdk:"uuid"`
24+ OwnedByProject string `json:"ownedByProject" tfsdk:"owned_by_project"`
25+ OwnedByWorkspace string `json:"ownedByWorkspace" tfsdk:"owned_by_workspace"`
26+ CreatedOn string `json:"createdOn" tfsdk:"created_on"`
27+ MarkedForDeletionOn * string `json:"markedForDeletionOn" tfsdk:"marked_for_deletion_on"`
28+ DeletedOn * string `json:"deletedOn" tfsdk:"deleted_on"`
2829}
2930
30- type MeshTenantSpecV4 struct {
31- PlatformIdentifier string `json:"platformIdentifier" tfsdk:"platform_identifier"`
32- LocalId * string `json:"localId " tfsdk:"local_id "`
33- LandingZoneIdentifier string `json:"landingZoneIdentifier" tfsdk:"landing_zone_identifier"`
34- Quotas []MeshTenantQuota `json:"quotas" tfsdk:"quotas"`
31+ type MeshTenantV4Spec struct {
32+ PlatformIdentifier string `json:"platformIdentifier" tfsdk:"platform_identifier"`
33+ PlatformTenantId * string `json:"platformTenantId " tfsdk:"platform_tenant_id "`
34+ LandingZoneIdentifier * string `json:"landingZoneIdentifier" tfsdk:"landing_zone_identifier"`
35+ Quotas * []MeshTenantQuota `json:"quotas" tfsdk:"quotas"`
3536}
3637
37- type MeshTenantStatusV4 struct {
38- Tags map [string ][]string `json:"tags" tfsdk:"tags"`
39- LastReplicated * string `json:"lastReplicated" tfsdk:"last_replicated"`
40- CurrentReplicationStatus string `json:"currentReplicationStatus" tfsdk:"current_replication_status"`
38+ type MeshTenantV4Status struct {
39+ TenantName string `json:"tenantName" tfsdk:"tenant_name"`
40+ PlatformTypeIdentifier string `json:"platformTypeIdentifier" tfsdk:"platform_type_identifier"`
41+ PlatformWorkspaceIdentifier * string `json:"platformWorkspaceIdentifier" tfsdk:"platform_workspace_identifier"`
42+ Tags map [string ][]string `json:"tags" tfsdk:"tags"`
4143}
4244
43- type MeshTenantCreateV4 struct {
44- Metadata MeshTenantCreateMetadataV4 `json:"metadata" tfsdk:"metadata"`
45- Spec MeshTenantCreateSpecV4 `json:"spec" tfsdk:"spec"`
45+ type MeshTenantV4Create struct {
46+ Metadata MeshTenantV4CreateMetadata `json:"metadata" tfsdk:"metadata"`
47+ Spec MeshTenantV4CreateSpec `json:"spec" tfsdk:"spec"`
4648}
4749
48- type MeshTenantCreateMetadataV4 struct {
49- UUID string `json:"uuid" tfsdk:"uuid"`
50+ type MeshTenantV4CreateMetadata struct {
5051 OwnedByProject string `json:"ownedByProject" tfsdk:"owned_by_project"`
5152 OwnedByWorkspace string `json:"ownedByWorkspace" tfsdk:"owned_by_workspace"`
5253}
5354
54- type MeshTenantCreateSpecV4 struct {
55- PlatformIdentifier string `json:"platformIdentifier" tfsdk:"platform_identifier"`
56- LocalId * string `json:"localId " tfsdk:"local_id "`
57- LandingZoneIdentifier string `json:"landingZoneIdentifier " tfsdk:"landing_zone_identifier "`
58- Quotas []MeshTenantQuota `json:"quotas" tfsdk:"quotas"`
55+ type MeshTenantV4CreateSpec struct {
56+ PlatformIdentifier string `json:"platformIdentifier" tfsdk:"platform_identifier"`
57+ LandingZoneIdentifier * string `json:"landingZoneIdentifier " tfsdk:"landing_zone_identifier "`
58+ PlatformTenantId * string `json:"platformTenantId " tfsdk:"platform_tenant_id "`
59+ Quotas * []MeshTenantQuota `json:"quotas" tfsdk:"quotas"`
5960}
6061
6162func (c * MeshStackProviderClient ) urlForTenantV4 (uuid string ) * url.URL {
@@ -99,7 +100,7 @@ func (c *MeshStackProviderClient) ReadTenantV4(uuid string) (*MeshTenantV4, erro
99100 return & tenant , nil
100101}
101102
102- func (c * MeshStackProviderClient ) CreateTenantV4 (tenant * MeshTenantCreateV4 ) (* MeshTenantV4 , error ) {
103+ func (c * MeshStackProviderClient ) CreateTenantV4 (tenant * MeshTenantV4Create ) (* MeshTenantV4 , error ) {
103104 payload , err := json .Marshal (tenant )
104105 if err != nil {
105106 return nil , err
@@ -124,7 +125,7 @@ func (c *MeshStackProviderClient) CreateTenantV4(tenant *MeshTenantCreateV4) (*M
124125 return nil , err
125126 }
126127
127- if res . StatusCode != 200 {
128+ if ! isSuccessHTTPStatus ( res ) {
128129 return nil , fmt .Errorf ("unexpected status code: %d, %s" , res .StatusCode , data )
129130 }
130131
0 commit comments