Skip to content

Commit

Permalink
API update, small bugfixes, service list update
Browse files Browse the repository at this point in the history
  • Loading branch information
stelcheck committed Jul 13, 2018
1 parent 50fef40 commit f0a5f42
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 23 deletions.
7 changes: 3 additions & 4 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,3 @@
[prune]
go-tests = true
unused-packages = true

[[constraint]]
branch = "features/start-servers"
name = "github.com/NaverCloudPlatform/ncloud-sdk-go"
source = "github.com/stelcheck/ncloud-sdk-go"
12 changes: 4 additions & 8 deletions Services.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
| 1 | KR | Korea |
| 2 | USW | US-West |
| 3 | HK | HongKong |
| 4 | SG | Singapore(Old) |
| 5 | JP | Japan |
| 5 | JP | Japan(Old) |
| 6 | DE | Germany |
| 7 | SGN | Singapore(New) |
| 8 | JPN | Japan(New) |

## Zones

| # | Name | Description |
| - | ---------- | ------------- |
| 2 | KR-1 | 가산 zone |
| 3 | KR-2 | 평촌 zone |
| 2 | KR-1 | 가산 zone |
| 10 | USW-1 | 미국 서부 ZONE |
| 20 | HK-1 | 홍콩 ZONE |
| 30 | SG-1 | 싱가포르(Old) ZONE |
| 40 | JP-1 | 일본 ZONE |
| 60 | DE-1 | 독일 ZONE |
| 70 | SGN-1 | 싱가포르(New) ZONE |
| 80 | JPN-1 | 일본(New) ZONE |

## Servers (server_product_code)

Expand All @@ -44,8 +44,6 @@
| SPSVRSTAND000051 | vCPU 8EA, Memory 8GB, Disk 50GB |
| SPSVRSTAND000006 | vCPU 8EA, Memory 16GB, Disk 50GB |
| SPSVRSTAND000055 | vCPU 8EA, Memory 32GB, Disk 50GB |
| SPSVRSTAND000030 | vCPU 12EA, Memory 16GB, Disk 50GB |
| SPSVRSTAND000022 | vCPU 12EA, Memory 32GB, Disk 50GB |
| SPSVRSTAND000053 | vCPU 16EA, Memory 16GB, Disk 50GB |
| SPSVRSTAND000046 | vCPU 16EA, Memory 32GB, Disk 50GB |
| SPSVRSSD00000003 | vCPU 2EA, Memory 4GB, [SSD]Disk 50GB |
Expand All @@ -58,8 +56,6 @@
| SPSVRSSD00000006 | vCPU 8EA, Memory 8GB, [SSD]Disk 50GB |
| SPSVRSSD00000007 | vCPU 8EA, Memory 16GB, [SSD]Disk 50GB |
| SPSVRSSD00000014 | vCPU 8EA, Memory 32GB, [SSD]Disk 50GB |
| SPSVRSSD00000008 | vCPU 12EA, Memory 16GB, [SSD]Disk 50GB |
| SPSVRSSD00000015 | vCPU 12EA, Memory 32GB, [SSD]Disk 50GB |
| SPSVRSSD00000009 | vCPU 16EA, Memory 16GB, [SSD]Disk 50GB |
| SPSVRSSD00000016 | vCPU 16EA, Memory 32GB, [SSD]Disk 50GB |
| SPSVRSTAND000059 | vCPU 8EA, Memory 64GB, Disk 50GB |
Expand Down
4 changes: 2 additions & 2 deletions src/ncloud-products-list/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
)

func main() {
accessKey := os.Getenv("NCLOUD_ACCESS_KEY")
secretKey := os.Getenv("NCLOUD_SECRET_KEY")
accessKey := os.Getenv("NCLOUD_ACCESS_KEY_ID")
secretKey := os.Getenv("NCLOUD_SECRET_ACCESS_KEY")

client := sdk.NewConnection(accessKey, secretKey)

Expand Down
8 changes: 6 additions & 2 deletions src/terraform-provider-ncloud/resource_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,13 @@ func resourceInstanceCreate(data *schema.ResourceData, meta interface{}) error {
createReqParams.ServerImageProductCode = data.Get("server_image_product_code").(string)
createReqParams.ServerProductCode = data.Get("server_product_code").(string)
createReqParams.LoginKeyName = data.Get("login_keyname").(string)
createReqParams.IsProtectServerTermination = data.Get("termination_protection").(bool)
createReqParams.UserData = data.Get("user_data").(string)
createReqParams.ServerCreateCount = 1
createReqParams.IsProtectServerTermination = "false"

if data.Get("termination_protection").(bool) {
createReqParams.IsProtectServerTermination = "true"
}

response, err := client.CreateServerInstances(createReqParams)
if err != nil {
Expand Down Expand Up @@ -166,7 +170,7 @@ func resourceInstanceDelete(data *schema.ResourceData, meta interface{}) error {
publicIP := data.Get("public_ip").(string)

publicIPReqParams := new(sdk.RequestPublicIPInstanceList)
publicIPReqParams.IsAssociated = true
publicIPReqParams.IsAssociated = "true"

publicIPListResponse, err := client.GetPublicIPInstanceList(publicIPReqParams)
if err != nil {
Expand Down
9 changes: 7 additions & 2 deletions src/terraform-provider-ncloud/resource_public_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ func resourcePublicIP() *schema.Resource {
ForceNew: true,
Description: "Region number (see https://github.com/Wizcorp/terraform-provider-ncloud/blob/master/Services.md#regions)",
},
"zone_number": &schema.Schema{
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "Zone number (see https://github.com/Wizcorp/terraform-provider-ncloud/blob/master/Services.md#regions)",
},
"public_ip": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Expand All @@ -58,8 +64,7 @@ func resourcePublicIPCreate(data *schema.ResourceData, meta interface{}) error {

reqParams := new(sdk.RequestCreatePublicIPInstance)
reqParams.RegionNo = data.Get("region_number").(string)
// API doc says we should be allowed to specify th zone
// reqParams.ZoneNo = serverInfo.Zone.ZoneNo
reqParams.ZoneNo = data.Get("zone_number").(string)

ipInfo, err := retryResourcePublicIPCreate(client, reqParams, 5)
if err != nil {
Expand Down

0 comments on commit f0a5f42

Please sign in to comment.