-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,066 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...les/bcc/example_bind_bcc_reserved_tags.go → ...eserved/example_bind_bcc_reserved_tags.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package bcc | ||
package reserved | ||
|
||
import ( | ||
"github.com/baidubce/bce-sdk-go/model" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package reserved | ||
|
||
import ( | ||
"fmt" | ||
"github.com/baidubce/bce-sdk-go/services/bcc/api" | ||
|
||
"github.com/baidubce/bce-sdk-go/services/bcc" | ||
) | ||
|
||
func CreateReservedInstance() { | ||
|
||
// 初始化AK/SK/Endpoint | ||
ak, sk, endpoint := "ak", "sk", "bcc.bj.baidubce.com" | ||
// 创建BCC Client | ||
client, _ := bcc.NewClient(ak, sk, endpoint) | ||
|
||
args := &api.CreateReservedInstanceArgs{ | ||
ClientToken: "myClientToken", | ||
ReservedInstanceName: "myReservedInstance", | ||
Scope: "AZ", | ||
ZoneName: "cn-bj-a", | ||
Spec: "bcc.g5.c2m8", | ||
OfferingType: "FullyPrepay", | ||
InstanceCount: 1, | ||
ReservedInstanceCount: 1, | ||
ReservedInstanceTime: 365, | ||
ReservedInstanceTimeUnit: "month", | ||
AutoRenewTimeUnit: "month", | ||
AutoRenewTime: 1, | ||
AutoRenew: true, | ||
Tags: []api.Tag{ | ||
{ | ||
TagKey: "Env", | ||
TagValue: "Production", | ||
}, | ||
}, | ||
EhcClusterId: "ehcCluster123", | ||
TicketId: "ticket456", | ||
} | ||
|
||
result, err := client.CreateReservedInstance(args) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
fmt.Println(result) | ||
} |
31 changes: 31 additions & 0 deletions
31
examples/bcc/reserved/example_modify_reserved_instances.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package reserved | ||
|
||
import ( | ||
"fmt" | ||
"github.com/baidubce/bce-sdk-go/services/bcc" | ||
"github.com/baidubce/bce-sdk-go/services/bcc/api" | ||
) | ||
|
||
func ModifyReservedInstances() { | ||
|
||
// 初始化AK/SK/Endpoint | ||
ak, sk, endpoint := "ak", "sk", "bcc.bj.baidubce.com" | ||
// 创建BCC Client | ||
client, _ := bcc.NewClient(ak, sk, endpoint) | ||
|
||
args := &api.ModifyReservedInstancesArgs{ | ||
ReservedInstances: []api.ModifyReservedInstance{ | ||
{ | ||
ReservedInstanceId: "r-UBVQFB5b", | ||
ReservedInstanceName: "update-reserved-instance", | ||
}, | ||
}, | ||
} | ||
|
||
result, err := client.ModifyReservedInstances(args) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
fmt.Println(result) | ||
} |
2 changes: 1 addition & 1 deletion
2
...s/bcc/example_unbind_bcc_reserved_tags.go → ...erved/example_unbind_bcc_reserved_tags.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package bcc | ||
package reserved | ||
|
||
import ( | ||
"github.com/baidubce/bce-sdk-go/model" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2017 Baidu, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file | ||
* except in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the | ||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
package eipexamples | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
func RefundEip() { | ||
Init() | ||
|
||
// 预付费eip退订 | ||
eip := "x.x.x.x" | ||
err := eipClient.RefundEip(eip, "") | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
fmt.Println("Refund prepay EIP successfully") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2017 Baidu, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file | ||
* except in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the | ||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
package eipexamples | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
func RefundEipGroup() { | ||
Init() | ||
|
||
// 待退订的预付费的eipgroup的id | ||
id := "eg-xxxxxxxx" | ||
err := eipClient.RefundEipGroup(id, "") | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
fmt.Println("Refund prepay EipGroup successfully") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.