diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 08e82c4..7e56fe2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.15" + ".": "0.1.0-alpha.16" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index d043adf..630a66c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 22 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nirvana-labs%2Fnirvana-d8b14b02cc12fe3d02746b57785b25e6bf1aa4ee26c9148e519a467ca6dfd838.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nirvana-labs%2Fnirvana-fd4009b8ae32cedd4b3c01020851fe7216717cbdd2a11f003758dc4a0caef76c.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 604c625..365ff32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 0.1.0-alpha.16 (2025-01-29) + +Full Changelog: [v0.1.0-alpha.15...v0.1.0-alpha.16](https://github.com/nirvana-labs/nirvana-go/compare/v0.1.0-alpha.15...v0.1.0-alpha.16) + +### Features + +* **api:** api update ([#63](https://github.com/nirvana-labs/nirvana-go/issues/63)) ([c72e477](https://github.com/nirvana-labs/nirvana-go/commit/c72e477047dbcc7f98a29d4225eb7f4d89b452dd)) +* **api:** api update ([#65](https://github.com/nirvana-labs/nirvana-go/issues/65)) ([018ea8e](https://github.com/nirvana-labs/nirvana-go/commit/018ea8e7aafbb986465011cdb5a099077f8d137b)) +* **api:** api update ([#67](https://github.com/nirvana-labs/nirvana-go/issues/67)) ([de2bdc6](https://github.com/nirvana-labs/nirvana-go/commit/de2bdc6283877af8d496158e910988c13b6ac977)) + + +### Chores + +* refactor client tests ([#66](https://github.com/nirvana-labs/nirvana-go/issues/66)) ([99ad192](https://github.com/nirvana-labs/nirvana-go/commit/99ad1923f00863290310ede2fdcf5d13adc767f1)) + ## 0.1.0-alpha.15 (2025-01-27) Full Changelog: [v0.1.0-alpha.14...v0.1.0-alpha.15](https://github.com/nirvana-labs/nirvana-go/compare/v0.1.0-alpha.14...v0.1.0-alpha.15) diff --git a/README.md b/README.md index c415400..dcb2f49 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Or to pin the version: ```sh -go get -u 'github.com/nirvana-labs/nirvana-go@v0.1.0-alpha.15' +go get -u 'github.com/nirvana-labs/nirvana-go@v0.1.0-alpha.16' ``` @@ -66,7 +66,7 @@ func main() { Ram: nirvana.F(compute.RamParam{ Size: nirvana.F(int64(2)), }), - Region: nirvana.F(shared.RegionNameAmsterdam), + Region: nirvana.F(shared.RegionNameUsSea1), SourceAddress: nirvana.F("0.0.0.0/0"), SSHKey: nirvana.F(compute.SSHKeyParam{ PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"), @@ -207,7 +207,7 @@ _, err := client.Compute.VMs.New(context.TODO(), compute.VMNewParams{ Ram: nirvana.F(compute.RamParam{ Size: nirvana.F(int64(2)), }), - Region: nirvana.F(shared.RegionNameAmsterdam), + Region: nirvana.F(shared.RegionNameUsSea1), SourceAddress: nirvana.F("0.0.0.0/0"), SSHKey: nirvana.F(compute.SSHKeyParam{ PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"), @@ -253,7 +253,7 @@ client.Compute.VMs.New( Ram: nirvana.F(compute.RamParam{ Size: nirvana.F(int64(2)), }), - Region: nirvana.F(shared.RegionNameAmsterdam), + Region: nirvana.F(shared.RegionNameUsSea1), SourceAddress: nirvana.F("0.0.0.0/0"), SSHKey: nirvana.F(compute.SSHKeyParam{ PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"), @@ -308,7 +308,7 @@ client.Compute.VMs.New( Ram: nirvana.F(compute.RamParam{ Size: nirvana.F(int64(2)), }), - Region: nirvana.F(shared.RegionNameAmsterdam), + Region: nirvana.F(shared.RegionNameUsSea1), SourceAddress: nirvana.F("0.0.0.0/0"), SSHKey: nirvana.F(compute.SSHKeyParam{ PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"), diff --git a/aliases.go b/aliases.go index 349ab16..e1e68c6 100644 --- a/aliases.go +++ b/aliases.go @@ -13,46 +13,34 @@ type Error = apierror.Error type RegionName = shared.RegionName // This is an alias to an internal value. -const RegionNameAmsterdam = shared.RegionNameAmsterdam +const RegionNameUsSea1 = shared.RegionNameUsSea1 // This is an alias to an internal value. -const RegionNameChicago = shared.RegionNameChicago +const RegionNameUsSva1 = shared.RegionNameUsSva1 // This is an alias to an internal value. -const RegionNameFrankfurt = shared.RegionNameFrankfurt +const RegionNameUsChi1 = shared.RegionNameUsChi1 // This is an alias to an internal value. -const RegionNameHongkong = shared.RegionNameHongkong +const RegionNameUsWdc1 = shared.RegionNameUsWdc1 // This is an alias to an internal value. -const RegionNameLondon = shared.RegionNameLondon +const RegionNameEuLon1 = shared.RegionNameEuLon1 // This is an alias to an internal value. -const RegionNameMumbai = shared.RegionNameMumbai +const RegionNameEuAms1 = shared.RegionNameEuAms1 // This is an alias to an internal value. -const RegionNameSaopaulo = shared.RegionNameSaopaulo +const RegionNameEuFrk1 = shared.RegionNameEuFrk1 // This is an alias to an internal value. -const RegionNameSeattle = shared.RegionNameSeattle +const RegionNameApMum1 = shared.RegionNameApMum1 // This is an alias to an internal value. -const RegionNameSiliconvalley = shared.RegionNameSiliconvalley +const RegionNameApSin1 = shared.RegionNameApSin1 // This is an alias to an internal value. -const RegionNameSingapore = shared.RegionNameSingapore - -// This is an alias to an internal value. -const RegionNameStockholm = shared.RegionNameStockholm - -// This is an alias to an internal value. -const RegionNameSydney = shared.RegionNameSydney - -// This is an alias to an internal value. -const RegionNameTokyo = shared.RegionNameTokyo - -// This is an alias to an internal value. -const RegionNameWashingtondc = shared.RegionNameWashingtondc +const RegionNameApTyo1 = shared.RegionNameApTyo1 // This is an alias to an internal type. type ResourceStatus = shared.ResourceStatus diff --git a/client_test.go b/client_test.go index 2ede30e..d03df07 100644 --- a/client_test.go +++ b/client_test.go @@ -53,7 +53,7 @@ func TestUserAgentHeader(t *testing.T) { Ram: nirvana.F(compute.RamParam{ Size: nirvana.F(int64(2)), }), - Region: nirvana.F(shared.RegionNameAmsterdam), + Region: nirvana.F(shared.RegionNameUsSea1), SourceAddress: nirvana.F("0.0.0.0/0"), SSHKey: nirvana.F(compute.SSHKeyParam{ PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"), @@ -81,7 +81,7 @@ func TestRetryAfter(t *testing.T) { }, }), ) - res, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{ + _, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{ BootVolume: nirvana.F(compute.VMNewParamsBootVolume{ Size: nirvana.F(int64(100)), }), @@ -95,14 +95,14 @@ func TestRetryAfter(t *testing.T) { Ram: nirvana.F(compute.RamParam{ Size: nirvana.F(int64(2)), }), - Region: nirvana.F(shared.RegionNameAmsterdam), + Region: nirvana.F(shared.RegionNameUsSea1), SourceAddress: nirvana.F("0.0.0.0/0"), SSHKey: nirvana.F(compute.SSHKeyParam{ PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"), }), }) - if err == nil || res != nil { - t.Error("Expected there to be a cancel error and for the response to be nil") + if err == nil { + t.Error("Expected there to be a cancel error") } attempts := len(retryCountHeaders) @@ -134,7 +134,7 @@ func TestDeleteRetryCountHeader(t *testing.T) { }), option.WithHeaderDel("X-Stainless-Retry-Count"), ) - res, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{ + _, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{ BootVolume: nirvana.F(compute.VMNewParamsBootVolume{ Size: nirvana.F(int64(100)), }), @@ -148,14 +148,14 @@ func TestDeleteRetryCountHeader(t *testing.T) { Ram: nirvana.F(compute.RamParam{ Size: nirvana.F(int64(2)), }), - Region: nirvana.F(shared.RegionNameAmsterdam), + Region: nirvana.F(shared.RegionNameUsSea1), SourceAddress: nirvana.F("0.0.0.0/0"), SSHKey: nirvana.F(compute.SSHKeyParam{ PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"), }), }) - if err == nil || res != nil { - t.Error("Expected there to be a cancel error and for the response to be nil") + if err == nil { + t.Error("Expected there to be a cancel error") } expectedRetryCountHeaders := []string{"", "", ""} @@ -182,7 +182,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) { }), option.WithHeader("X-Stainless-Retry-Count", "42"), ) - res, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{ + _, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{ BootVolume: nirvana.F(compute.VMNewParamsBootVolume{ Size: nirvana.F(int64(100)), }), @@ -196,14 +196,14 @@ func TestOverwriteRetryCountHeader(t *testing.T) { Ram: nirvana.F(compute.RamParam{ Size: nirvana.F(int64(2)), }), - Region: nirvana.F(shared.RegionNameAmsterdam), + Region: nirvana.F(shared.RegionNameUsSea1), SourceAddress: nirvana.F("0.0.0.0/0"), SSHKey: nirvana.F(compute.SSHKeyParam{ PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"), }), }) - if err == nil || res != nil { - t.Error("Expected there to be a cancel error and for the response to be nil") + if err == nil { + t.Error("Expected there to be a cancel error") } expectedRetryCountHeaders := []string{"42", "42", "42"} @@ -229,7 +229,7 @@ func TestRetryAfterMs(t *testing.T) { }, }), ) - res, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{ + _, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{ BootVolume: nirvana.F(compute.VMNewParamsBootVolume{ Size: nirvana.F(int64(100)), }), @@ -243,14 +243,14 @@ func TestRetryAfterMs(t *testing.T) { Ram: nirvana.F(compute.RamParam{ Size: nirvana.F(int64(2)), }), - Region: nirvana.F(shared.RegionNameAmsterdam), + Region: nirvana.F(shared.RegionNameUsSea1), SourceAddress: nirvana.F("0.0.0.0/0"), SSHKey: nirvana.F(compute.SSHKeyParam{ PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"), }), }) - if err == nil || res != nil { - t.Error("Expected there to be a cancel error and for the response to be nil") + if err == nil { + t.Error("Expected there to be a cancel error") } if want := 3; attempts != want { t.Errorf("Expected %d attempts, got %d", want, attempts) @@ -270,7 +270,7 @@ func TestContextCancel(t *testing.T) { ) cancelCtx, cancel := context.WithCancel(context.Background()) cancel() - res, err := client.Compute.VMs.New(cancelCtx, compute.VMNewParams{ + _, err := client.Compute.VMs.New(cancelCtx, compute.VMNewParams{ BootVolume: nirvana.F(compute.VMNewParamsBootVolume{ Size: nirvana.F(int64(100)), }), @@ -284,14 +284,14 @@ func TestContextCancel(t *testing.T) { Ram: nirvana.F(compute.RamParam{ Size: nirvana.F(int64(2)), }), - Region: nirvana.F(shared.RegionNameAmsterdam), + Region: nirvana.F(shared.RegionNameUsSea1), SourceAddress: nirvana.F("0.0.0.0/0"), SSHKey: nirvana.F(compute.SSHKeyParam{ PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"), }), }) - if err == nil || res != nil { - t.Error("Expected there to be a cancel error and for the response to be nil") + if err == nil { + t.Error("Expected there to be a cancel error") } } @@ -308,7 +308,7 @@ func TestContextCancelDelay(t *testing.T) { ) cancelCtx, cancel := context.WithTimeout(context.Background(), 2*time.Millisecond) defer cancel() - res, err := client.Compute.VMs.New(cancelCtx, compute.VMNewParams{ + _, err := client.Compute.VMs.New(cancelCtx, compute.VMNewParams{ BootVolume: nirvana.F(compute.VMNewParamsBootVolume{ Size: nirvana.F(int64(100)), }), @@ -322,14 +322,14 @@ func TestContextCancelDelay(t *testing.T) { Ram: nirvana.F(compute.RamParam{ Size: nirvana.F(int64(2)), }), - Region: nirvana.F(shared.RegionNameAmsterdam), + Region: nirvana.F(shared.RegionNameUsSea1), SourceAddress: nirvana.F("0.0.0.0/0"), SSHKey: nirvana.F(compute.SSHKeyParam{ PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"), }), }) - if err == nil || res != nil { - t.Error("expected there to be a cancel error and for the response to be nil") + if err == nil { + t.Error("expected there to be a cancel error") } } @@ -352,7 +352,7 @@ func TestContextDeadline(t *testing.T) { }, }), ) - res, err := client.Compute.VMs.New(deadlineCtx, compute.VMNewParams{ + _, err := client.Compute.VMs.New(deadlineCtx, compute.VMNewParams{ BootVolume: nirvana.F(compute.VMNewParamsBootVolume{ Size: nirvana.F(int64(100)), }), @@ -366,14 +366,14 @@ func TestContextDeadline(t *testing.T) { Ram: nirvana.F(compute.RamParam{ Size: nirvana.F(int64(2)), }), - Region: nirvana.F(shared.RegionNameAmsterdam), + Region: nirvana.F(shared.RegionNameUsSea1), SourceAddress: nirvana.F("0.0.0.0/0"), SSHKey: nirvana.F(compute.SSHKeyParam{ PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"), }), }) - if err == nil || res != nil { - t.Error("expected there to be a deadline error and for the response to be nil") + if err == nil { + t.Error("expected there to be a deadline error") } close(testDone) }() diff --git a/compute/aliases.go b/compute/aliases.go index 7f0e6ef..501dac4 100644 --- a/compute/aliases.go +++ b/compute/aliases.go @@ -13,46 +13,34 @@ type Error = apierror.Error type RegionName = shared.RegionName // This is an alias to an internal value. -const RegionNameAmsterdam = shared.RegionNameAmsterdam +const RegionNameUsSea1 = shared.RegionNameUsSea1 // This is an alias to an internal value. -const RegionNameChicago = shared.RegionNameChicago +const RegionNameUsSva1 = shared.RegionNameUsSva1 // This is an alias to an internal value. -const RegionNameFrankfurt = shared.RegionNameFrankfurt +const RegionNameUsChi1 = shared.RegionNameUsChi1 // This is an alias to an internal value. -const RegionNameHongkong = shared.RegionNameHongkong +const RegionNameUsWdc1 = shared.RegionNameUsWdc1 // This is an alias to an internal value. -const RegionNameLondon = shared.RegionNameLondon +const RegionNameEuLon1 = shared.RegionNameEuLon1 // This is an alias to an internal value. -const RegionNameMumbai = shared.RegionNameMumbai +const RegionNameEuAms1 = shared.RegionNameEuAms1 // This is an alias to an internal value. -const RegionNameSaopaulo = shared.RegionNameSaopaulo +const RegionNameEuFrk1 = shared.RegionNameEuFrk1 // This is an alias to an internal value. -const RegionNameSeattle = shared.RegionNameSeattle +const RegionNameApMum1 = shared.RegionNameApMum1 // This is an alias to an internal value. -const RegionNameSiliconvalley = shared.RegionNameSiliconvalley +const RegionNameApSin1 = shared.RegionNameApSin1 // This is an alias to an internal value. -const RegionNameSingapore = shared.RegionNameSingapore - -// This is an alias to an internal value. -const RegionNameStockholm = shared.RegionNameStockholm - -// This is an alias to an internal value. -const RegionNameSydney = shared.RegionNameSydney - -// This is an alias to an internal value. -const RegionNameTokyo = shared.RegionNameTokyo - -// This is an alias to an internal value. -const RegionNameWashingtondc = shared.RegionNameWashingtondc +const RegionNameApTyo1 = shared.RegionNameApTyo1 // This is an alias to an internal type. type ResourceStatus = shared.ResourceStatus diff --git a/compute/vm.go b/compute/vm.go index 6a508d6..f1d54cc 100644 --- a/compute/vm.go +++ b/compute/vm.go @@ -186,13 +186,12 @@ func (r SSHKeyParam) MarshalJSON() (data []byte, err error) { // VM details. type VM struct { - ID string `json:"id,required"` - // Volume details. - BootVolume Volume `json:"boot_volume,required"` + ID string `json:"id,required"` + BootVolumeID string `json:"boot_volume_id,required"` // CPU details. - CPUConfig CPU `json:"cpu_config,required"` - CreatedAt string `json:"created_at,required"` - DataVolumes []Volume `json:"data_volumes,required"` + CPUConfig CPU `json:"cpu_config,required"` + CreatedAt string `json:"created_at,required"` + DataVolumeIDs []string `json:"data_volume_ids,required"` // RAM details. MemConfig Ram `json:"mem_config,required"` Name string `json:"name,required"` @@ -206,20 +205,20 @@ type VM struct { // vmJSON contains the JSON metadata for the struct [VM] type vmJSON struct { - ID apijson.Field - BootVolume apijson.Field - CPUConfig apijson.Field - CreatedAt apijson.Field - DataVolumes apijson.Field - MemConfig apijson.Field - Name apijson.Field - PublicIP apijson.Field - Region apijson.Field - Status apijson.Field - UpdatedAt apijson.Field - VPCID apijson.Field - raw string - ExtraFields map[string]apijson.Field + ID apijson.Field + BootVolumeID apijson.Field + CPUConfig apijson.Field + CreatedAt apijson.Field + DataVolumeIDs apijson.Field + MemConfig apijson.Field + Name apijson.Field + PublicIP apijson.Field + Region apijson.Field + Status apijson.Field + UpdatedAt apijson.Field + VPCID apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *VM) UnmarshalJSON(data []byte) (err error) { diff --git a/compute/vm_test.go b/compute/vm_test.go index 870be8d..ece41f1 100644 --- a/compute/vm_test.go +++ b/compute/vm_test.go @@ -41,7 +41,7 @@ func TestVMNewWithOptionalParams(t *testing.T) { Ram: nirvana.F(compute.RamParam{ Size: nirvana.F(int64(2)), }), - Region: nirvana.F(shared.RegionNameAmsterdam), + Region: nirvana.F(shared.RegionNameUsSea1), SourceAddress: nirvana.F("0.0.0.0/0"), SSHKey: nirvana.F(compute.SSHKeyParam{ PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"), diff --git a/internal/version.go b/internal/version.go index 13b9ceb..f578972 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.1.0-alpha.15" // x-release-please-version +const PackageVersion = "0.1.0-alpha.16" // x-release-please-version diff --git a/networking/aliases.go b/networking/aliases.go index bd25d5d..695d52e 100644 --- a/networking/aliases.go +++ b/networking/aliases.go @@ -13,46 +13,34 @@ type Error = apierror.Error type RegionName = shared.RegionName // This is an alias to an internal value. -const RegionNameAmsterdam = shared.RegionNameAmsterdam +const RegionNameUsSea1 = shared.RegionNameUsSea1 // This is an alias to an internal value. -const RegionNameChicago = shared.RegionNameChicago +const RegionNameUsSva1 = shared.RegionNameUsSva1 // This is an alias to an internal value. -const RegionNameFrankfurt = shared.RegionNameFrankfurt +const RegionNameUsChi1 = shared.RegionNameUsChi1 // This is an alias to an internal value. -const RegionNameHongkong = shared.RegionNameHongkong +const RegionNameUsWdc1 = shared.RegionNameUsWdc1 // This is an alias to an internal value. -const RegionNameLondon = shared.RegionNameLondon +const RegionNameEuLon1 = shared.RegionNameEuLon1 // This is an alias to an internal value. -const RegionNameMumbai = shared.RegionNameMumbai +const RegionNameEuAms1 = shared.RegionNameEuAms1 // This is an alias to an internal value. -const RegionNameSaopaulo = shared.RegionNameSaopaulo +const RegionNameEuFrk1 = shared.RegionNameEuFrk1 // This is an alias to an internal value. -const RegionNameSeattle = shared.RegionNameSeattle +const RegionNameApMum1 = shared.RegionNameApMum1 // This is an alias to an internal value. -const RegionNameSiliconvalley = shared.RegionNameSiliconvalley +const RegionNameApSin1 = shared.RegionNameApSin1 // This is an alias to an internal value. -const RegionNameSingapore = shared.RegionNameSingapore - -// This is an alias to an internal value. -const RegionNameStockholm = shared.RegionNameStockholm - -// This is an alias to an internal value. -const RegionNameSydney = shared.RegionNameSydney - -// This is an alias to an internal value. -const RegionNameTokyo = shared.RegionNameTokyo - -// This is an alias to an internal value. -const RegionNameWashingtondc = shared.RegionNameWashingtondc +const RegionNameApTyo1 = shared.RegionNameApTyo1 // This is an alias to an internal type. type ResourceStatus = shared.ResourceStatus diff --git a/networking/vpc.go b/networking/vpc.go index 228cc4c..678b5c3 100644 --- a/networking/vpc.go +++ b/networking/vpc.go @@ -106,12 +106,12 @@ func (r subnetJSON) RawJSON() string { // VPC details. type VPC struct { - ID string `json:"id,required"` - CreatedAt string `json:"created_at,required"` - FirewallRules []FirewallRule `json:"firewall_rules,required"` - Name string `json:"name,required"` - Region shared.RegionName `json:"region,required"` - Status shared.ResourceStatus `json:"status,required"` + ID string `json:"id,required"` + CreatedAt string `json:"created_at,required"` + FirewallRuleIDs []string `json:"firewall_rule_ids,required"` + Name string `json:"name,required"` + Region shared.RegionName `json:"region,required"` + Status shared.ResourceStatus `json:"status,required"` // Subnet details. Subnet Subnet `json:"subnet,required"` UpdatedAt string `json:"updated_at,required"` @@ -120,16 +120,16 @@ type VPC struct { // vpcJSON contains the JSON metadata for the struct [VPC] type vpcJSON struct { - ID apijson.Field - CreatedAt apijson.Field - FirewallRules apijson.Field - Name apijson.Field - Region apijson.Field - Status apijson.Field - Subnet apijson.Field - UpdatedAt apijson.Field - raw string - ExtraFields map[string]apijson.Field + ID apijson.Field + CreatedAt apijson.Field + FirewallRuleIDs apijson.Field + Name apijson.Field + Region apijson.Field + Status apijson.Field + Subnet apijson.Field + UpdatedAt apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *VPC) UnmarshalJSON(data []byte) (err error) { diff --git a/networking/vpc_test.go b/networking/vpc_test.go index 943796a..48846bd 100644 --- a/networking/vpc_test.go +++ b/networking/vpc_test.go @@ -29,7 +29,7 @@ func TestVPCNew(t *testing.T) { ) _, err := client.Networking.VPCs.New(context.TODO(), networking.VPCNewParams{ Name: nirvana.F("my-vpc"), - Region: nirvana.F(shared.RegionNameAmsterdam), + Region: nirvana.F(shared.RegionNameUsSea1), SubnetName: nirvana.F("my-subnet"), }) if err != nil { diff --git a/operations/aliases.go b/operations/aliases.go index 194ef25..23bfe53 100644 --- a/operations/aliases.go +++ b/operations/aliases.go @@ -13,46 +13,34 @@ type Error = apierror.Error type RegionName = shared.RegionName // This is an alias to an internal value. -const RegionNameAmsterdam = shared.RegionNameAmsterdam +const RegionNameUsSea1 = shared.RegionNameUsSea1 // This is an alias to an internal value. -const RegionNameChicago = shared.RegionNameChicago +const RegionNameUsSva1 = shared.RegionNameUsSva1 // This is an alias to an internal value. -const RegionNameFrankfurt = shared.RegionNameFrankfurt +const RegionNameUsChi1 = shared.RegionNameUsChi1 // This is an alias to an internal value. -const RegionNameHongkong = shared.RegionNameHongkong +const RegionNameUsWdc1 = shared.RegionNameUsWdc1 // This is an alias to an internal value. -const RegionNameLondon = shared.RegionNameLondon +const RegionNameEuLon1 = shared.RegionNameEuLon1 // This is an alias to an internal value. -const RegionNameMumbai = shared.RegionNameMumbai +const RegionNameEuAms1 = shared.RegionNameEuAms1 // This is an alias to an internal value. -const RegionNameSaopaulo = shared.RegionNameSaopaulo +const RegionNameEuFrk1 = shared.RegionNameEuFrk1 // This is an alias to an internal value. -const RegionNameSeattle = shared.RegionNameSeattle +const RegionNameApMum1 = shared.RegionNameApMum1 // This is an alias to an internal value. -const RegionNameSiliconvalley = shared.RegionNameSiliconvalley +const RegionNameApSin1 = shared.RegionNameApSin1 // This is an alias to an internal value. -const RegionNameSingapore = shared.RegionNameSingapore - -// This is an alias to an internal value. -const RegionNameStockholm = shared.RegionNameStockholm - -// This is an alias to an internal value. -const RegionNameSydney = shared.RegionNameSydney - -// This is an alias to an internal value. -const RegionNameTokyo = shared.RegionNameTokyo - -// This is an alias to an internal value. -const RegionNameWashingtondc = shared.RegionNameWashingtondc +const RegionNameApTyo1 = shared.RegionNameApTyo1 // This is an alias to an internal type. type ResourceStatus = shared.ResourceStatus diff --git a/shared/shared.go b/shared/shared.go index 2ce147b..7ad011d 100644 --- a/shared/shared.go +++ b/shared/shared.go @@ -5,25 +5,21 @@ package shared type RegionName string const ( - RegionNameAmsterdam RegionName = "amsterdam" - RegionNameChicago RegionName = "chicago" - RegionNameFrankfurt RegionName = "frankfurt" - RegionNameHongkong RegionName = "hongkong" - RegionNameLondon RegionName = "london" - RegionNameMumbai RegionName = "mumbai" - RegionNameSaopaulo RegionName = "saopaulo" - RegionNameSeattle RegionName = "seattle" - RegionNameSiliconvalley RegionName = "siliconvalley" - RegionNameSingapore RegionName = "singapore" - RegionNameStockholm RegionName = "stockholm" - RegionNameSydney RegionName = "sydney" - RegionNameTokyo RegionName = "tokyo" - RegionNameWashingtondc RegionName = "washingtondc" + RegionNameUsSea1 RegionName = "us-sea-1" + RegionNameUsSva1 RegionName = "us-sva-1" + RegionNameUsChi1 RegionName = "us-chi-1" + RegionNameUsWdc1 RegionName = "us-wdc-1" + RegionNameEuLon1 RegionName = "eu-lon-1" + RegionNameEuAms1 RegionName = "eu-ams-1" + RegionNameEuFrk1 RegionName = "eu-frk-1" + RegionNameApMum1 RegionName = "ap-mum-1" + RegionNameApSin1 RegionName = "ap-sin-1" + RegionNameApTyo1 RegionName = "ap-tyo-1" ) func (r RegionName) IsKnown() bool { switch r { - case RegionNameAmsterdam, RegionNameChicago, RegionNameFrankfurt, RegionNameHongkong, RegionNameLondon, RegionNameMumbai, RegionNameSaopaulo, RegionNameSeattle, RegionNameSiliconvalley, RegionNameSingapore, RegionNameStockholm, RegionNameSydney, RegionNameTokyo, RegionNameWashingtondc: + case RegionNameUsSea1, RegionNameUsSva1, RegionNameUsChi1, RegionNameUsWdc1, RegionNameEuLon1, RegionNameEuAms1, RegionNameEuFrk1, RegionNameApMum1, RegionNameApSin1, RegionNameApTyo1: return true } return false diff --git a/usage_test.go b/usage_test.go index 7646dfc..c6565de 100644 --- a/usage_test.go +++ b/usage_test.go @@ -40,7 +40,7 @@ func TestUsage(t *testing.T) { Ram: nirvana.F(compute.RamParam{ Size: nirvana.F(int64(2)), }), - Region: nirvana.F(shared.RegionNameAmsterdam), + Region: nirvana.F(shared.RegionNameUsSea1), SourceAddress: nirvana.F("0.0.0.0/0"), SSHKey: nirvana.F(compute.SSHKeyParam{ PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"),