Skip to content

Commit ff24bab

Browse files
mikejihbecodycushing
authored andcommitted
Move loadbalancer api into the main package, Handle duplicate name overloaded names
1 parent f7764bb commit ff24bab

30 files changed

+61
-63
lines changed

core_shape_datasource.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
99
"github.com/oracle/terraform-provider-baremetal/crud"
1010
)
1111

12-
func ShapeDatasource() *schema.Resource {
12+
func InstanceShapeDatasource() *schema.Resource {
1313
return &schema.Resource{
14-
Read: readShape,
14+
Read: readInstanceShape,
1515
Schema: map[string]*schema.Schema{
1616
"shapes": {
1717
Type: schema.TypeList,
@@ -49,9 +49,9 @@ func ShapeDatasource() *schema.Resource {
4949
}
5050
}
5151

52-
func readShape(d *schema.ResourceData, m interface{}) (e error) {
52+
func readInstanceShape(d *schema.ResourceData, m interface{}) (e error) {
5353
client := m.(client.BareMetalClient)
54-
reader := &ShapeDatasourceCrud{}
54+
reader := &InstanceShapeDatasourceCrud{}
5555
reader.D = d
5656
reader.Client = client
5757

core_shape_datasource_crud.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ import (
1212
"github.com/oracle/terraform-provider-baremetal/crud"
1313
)
1414

15-
type ShapeDatasourceCrud struct {
15+
type InstanceShapeDatasourceCrud struct {
1616
crud.BaseCrud
1717
Res *baremetal.ListShapes
1818
}
1919

20-
func (r *ShapeDatasourceCrud) Get() (e error) {
20+
func (r *InstanceShapeDatasourceCrud) Get() (e error) {
2121
compartmentID := r.D.Get("compartment_id").(string)
2222

2323
opts := &baremetal.ListShapesOptions{}
@@ -47,7 +47,7 @@ func (r *ShapeDatasourceCrud) Get() (e error) {
4747
return
4848
}
4949

50-
func (r *ShapeDatasourceCrud) SetData() {
50+
func (r *InstanceShapeDatasourceCrud) SetData() {
5151
if r.Res != nil {
5252
// Important, if you don't have an ID, make one up for your datasource
5353
// or things will end in tears

identity_policy_datasource.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
99
"github.com/oracle/terraform-provider-baremetal/crud"
1010
)
1111

12-
func PolicyDatasource() *schema.Resource {
12+
func IdentityPolicyDatasource() *schema.Resource {
1313
return &schema.Resource{
14-
Read: readPolicies,
14+
Read: readIdentityPolicies,
1515
Schema: map[string]*schema.Schema{
1616
"compartment_id": {
1717
Type: schema.TypeString,
@@ -26,9 +26,9 @@ func PolicyDatasource() *schema.Resource {
2626
}
2727
}
2828

29-
func readPolicies(d *schema.ResourceData, m interface{}) (e error) {
29+
func readIdentityPolicies(d *schema.ResourceData, m interface{}) (e error) {
3030
client := m.(client.BareMetalClient)
31-
sync := &PolicyDatasourceCrud{}
31+
sync := &IdentityPolicyDatasourceCrud{}
3232
sync.D = d
3333
sync.Client = client
3434
return crud.ReadResource(sync)

identity_policy_datasource_crud.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ import (
1010
"github.com/oracle/terraform-provider-baremetal/crud"
1111
)
1212

13-
type PolicyDatasourceCrud struct {
13+
type IdentityPolicyDatasourceCrud struct {
1414
crud.BaseCrud
1515
Res *baremetal.ListPolicies
1616
}
1717

18-
func (s *PolicyDatasourceCrud) Get() (e error) {
18+
func (s *IdentityPolicyDatasourceCrud) Get() (e error) {
1919
compartment_id := s.D.Get("compartment_id").(string)
2020

2121
s.Res, e = s.Client.ListPolicies(compartment_id, nil)
2222
return
2323
}
2424

25-
func (s *PolicyDatasourceCrud) SetData() {
25+
func (s *IdentityPolicyDatasourceCrud) SetData() {
2626
if s.Res != nil {
2727
s.D.SetId(time.Now().UTC().String())
2828
resources := []map[string]interface{}{}

lb/backend_datasource.go renamed to loadbalancer_backend_datasource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
22

3-
package lb
3+
package main
44

55
import (
66
"github.com/hashicorp/terraform/helper/schema"

lb/backend_datasource_crud.go renamed to loadbalancer_backend_datasource_crud.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
22

3-
package lb
3+
package main
44

55
import (
66
"time"

lb/backend_resource.go renamed to loadbalancer_backend_resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
22

3-
package lb
3+
package main
44

55
import (
66
"github.com/hashicorp/terraform/helper/schema"

lb/backend_resource_crud.go renamed to loadbalancer_backend_resource_crud.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
22

3-
package lb
3+
package main
44

55
import (
66
"github.com/MustWin/baremetal-sdk-go"

lb/backend_set_resource.go renamed to loadbalancer_backend_set_resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
22

3-
package lb
3+
package main
44

55
import (
66
"github.com/hashicorp/terraform/helper/schema"

lb/backend_set_resource_crud.go renamed to loadbalancer_backend_set_resource_crud.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
22

3-
package lb
3+
package main
44

55
import (
66
"github.com/MustWin/baremetal-sdk-go"

0 commit comments

Comments
 (0)