From 41fb28fac4bce053dfbf24950f3e50cd0cc154ef Mon Sep 17 00:00:00 2001 From: Mike Ihbe Date: Mon, 3 Apr 2017 21:14:34 -0700 Subject: [PATCH 01/14] Add dhcpOptionsID and dnsLabel to the subnet resource. Closes #50 --- core/subnet_resource.go | 10 +++++++++- core/subnet_resource_crud.go | 11 +++++++++-- .../MustWin/baremetal-sdk-go/core_subnet.go | 4 +++- .../MustWin/baremetal-sdk-go/request_options.go | 1 + 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/core/subnet_resource.go b/core/subnet_resource.go index 2080dd763c8..5dbe93dde1c 100644 --- a/core/subnet_resource.go +++ b/core/subnet_resource.go @@ -53,6 +53,14 @@ func SubnetResource() *schema.Resource { Optional: true, Computed: true, }, + "dhcp_options_id": { + Type: schema.TypeString, + Optional: true, + }, + "dns_label": { + Type: schema.TypeString, + Optional: true, + }, "id": { Type: schema.TypeString, Computed: true, @@ -65,7 +73,7 @@ func SubnetResource() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "virtual_router_id": { + "virtual_router_ip": { Type: schema.TypeString, Computed: true, }, diff --git a/core/subnet_resource_crud.go b/core/subnet_resource_crud.go index ce3b9ae3928..b34a847f048 100644 --- a/core/subnet_resource_crud.go +++ b/core/subnet_resource_crud.go @@ -45,7 +45,12 @@ func (s *SubnetResourceCrud) Create() (e error) { vcnID := s.D.Get("vcn_id").(string) opts := &baremetal.CreateSubnetOptions{} - + if dhcpOptionsID, ok := s.D.GetOk("dhcp_options_id"); ok { + opts.DHCPOptionsID = dhcpOptionsID.(string) + } + if dnsLabel, ok := s.D.GetOk("dns_label"); ok { + opts.DNSLabel = dnsLabel.(string) + } if displayName, ok := s.D.GetOk("display_name"); ok { opts.DisplayName = displayName.(string) } @@ -95,12 +100,14 @@ func (s *SubnetResourceCrud) SetData() { s.D.Set("compartment_id", s.Resource.CompartmentID) s.D.Set("display_name", s.Resource.DisplayName) s.D.Set("cidr_block", s.Resource.CIDRBlock) + s.D.Set("dhcp_options_id", s.Resource.DHCPOptionsID) + s.D.Set("dns_label", s.Resource.DNSLabel) s.D.Set("route_table_id", s.Resource.RouteTableID) s.D.Set("vcn_id", s.Resource.VcnID) s.D.Set("security_list_ids", s.Resource.SecurityListIDs) s.D.Set("state", s.Resource.State) s.D.Set("time_created", s.Resource.TimeCreated.String()) - s.D.Set("virtual_router_id", s.Resource.VirtualRouterID) + s.D.Set("virtual_router_ip", s.Resource.VirtualRouterIP) s.D.Set("virtual_router_mac", s.Resource.VirtualRouterMac) } diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/core_subnet.go b/vendor/github.com/MustWin/baremetal-sdk-go/core_subnet.go index 80aa07eb144..db4d779e4e8 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/core_subnet.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/core_subnet.go @@ -14,13 +14,15 @@ type Subnet struct { CIDRBlock string `json:"cidrBlock"` CompartmentID string `json:"compartmentId"` DisplayName string `json:"displayName"` + DHCPOptionsID string `json:"dhcpOptionsId"` + DNSLabel string `json:"dnsLabel"` ID string `json:"id"` RouteTableID string `json:"routeTableId"` SecurityListIDs []string `json:"securityListIds"` State string `json:"lifecycleState"` TimeCreated Time `json:"timeCreated"` VcnID string `json:"vcnId"` - VirtualRouterID string `json:"virtualRouterId"` + VirtualRouterIP string `json:"virtualRouterIp"` VirtualRouterMac string `json:"virtualRouterMac"` } diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go b/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go index 2e00d4361e1..3d034b15b8c 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go @@ -55,6 +55,7 @@ type CreateBucketOptions struct { type CreateSubnetOptions struct { CreateOptions + DNSLabel string `header:"-" json:"dnsLabel,omitempty" url:"-"` DHCPOptionsID string `header:"-" json:"dhcpOptionsId,omitempty" url:"-"` RouteTableID string `header:"-" json:"routeTableId,omitempty" url:"-"` SecurityListIDs []string `header:"-" json:"securityListIds,omitempty" url:"-"` From ea7509555e8b724a88177200da2324aca2df039d Mon Sep 17 00:00:00 2001 From: Mike Ihbe Date: Mon, 3 Apr 2017 21:42:43 -0700 Subject: [PATCH 02/14] Add stateless attribute to security list --- core/security_list_resource.go | 5 +++++ core/security_list_resource_crud.go | 1 + 2 files changed, 6 insertions(+) diff --git a/core/security_list_resource.go b/core/security_list_resource.go index 5a8c7699f7c..e932c835936 100644 --- a/core/security_list_resource.go +++ b/core/security_list_resource.go @@ -105,6 +105,11 @@ func SecurityListResource() *schema.Resource { }, "tcp_options": transportSchema, "udp_options": transportSchema, + "stateless": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, }, }, }, diff --git a/core/security_list_resource_crud.go b/core/security_list_resource_crud.go index c4f065b8fba..136e863c46e 100644 --- a/core/security_list_resource_crud.go +++ b/core/security_list_resource_crud.go @@ -144,6 +144,7 @@ func (s *SecurityListResourceCrud) buildIngressRules() (sdkRules []baremetal.Ing Source: confRule["source"].(string), TCPOptions: s.buildTCPOptions(confRule), UDPOptions: s.buildUDPOptions(confRule), + IsStateless: confRule["stateless"].(bool), } sdkRules = append(sdkRules, sdkRule) From d9d3bf6daaf43ea5fa2f59d42a5316ee72fa9457 Mon Sep 17 00:00:00 2001 From: Mike Ihbe Date: Mon, 3 Apr 2017 22:44:20 -0700 Subject: [PATCH 03/14] Pick subnet changes --- core/route_table_resource.go | 4 +- .../MustWin/baremetal-sdk-go/Makefile | 3 + .../MustWin/baremetal-sdk-go/constants.go | 81 +++++--- .../baremetal-sdk-go/core_security_list.go | 1 + .../MustWin/baremetal-sdk-go/core_subnet.go | 22 +-- .../baremetal-sdk-go/loadbalancer_backend.go | 180 +++++++++++++++++ .../loadbalancer_backendset.go | 182 ++++++++++++++++++ .../loadbalancer_certificate.go | 123 ++++++++++++ .../loadbalancer_healthchecker.go | 78 ++++++++ .../baremetal-sdk-go/loadbalancer_listener.go | 118 ++++++++++++ .../loadbalancer_loadbalancer.go | 171 ++++++++++++++++ .../baremetal-sdk-go/loadbalancer_policy.go | 50 +++++ .../baremetal-sdk-go/loadbalancer_protocol.go | 50 +++++ .../baremetal-sdk-go/loadbalancer_shape.go | 51 +++++ .../loadbalancer_workrequest.go | 89 +++++++++ .../baremetal-sdk-go/request_options.go | 47 +++++ .../MustWin/baremetal-sdk-go/requestor.go | 12 +- .../MustWin/baremetal-sdk-go/response.go | 6 + .../response_unmarshallers.go | 12 ++ vendor/vendor.json | 6 +- 20 files changed, 1236 insertions(+), 50 deletions(-) create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backend.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backendset.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_certificate.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_healthchecker.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_listener.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_loadbalancer.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_policy.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_protocol.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_shape.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_workrequest.go diff --git a/core/route_table_resource.go b/core/route_table_resource.go index 9dc6ab210a4..0a0a5b2e1fb 100644 --- a/core/route_table_resource.go +++ b/core/route_table_resource.go @@ -36,11 +36,11 @@ func RouteTableResource() *schema.Resource { Schema: map[string]*schema.Schema{ "cidr_block": { Type: schema.TypeString, - Required: true, + Optional: true, }, "network_entity_id": { Type: schema.TypeString, - Required: true, + Optional: true, }, }, }, diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/Makefile b/vendor/github.com/MustWin/baremetal-sdk-go/Makefile index 5f095fad900..b24243b1348 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/Makefile +++ b/vendor/github.com/MustWin/baremetal-sdk-go/Makefile @@ -47,6 +47,9 @@ record_core_test: record_core_instance_test: @go test -v -tags "recording core_instance" github.com/MustWin/baremetal-sdk-go/acceptance-test +record_load_balancer_test: + @go test -v -tags "recording load_balancer" github.com/MustWin/baremetal-sdk-go/acceptance-test + .PHONY: build test regression_test identity_test core_test database_test object_test acceptance_test \ record_identity_user_test record_identity_group_test record_identity_user_group_membership_test \ record_core_test record_identity_policy_test diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/constants.go b/vendor/github.com/MustWin/baremetal-sdk-go/constants.go index a5c0723e864..7d476f65d7e 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/constants.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/constants.go @@ -14,36 +14,43 @@ type ListObjectOptionField string const ( // Resource States - ResourceActive = "ACTIVE" - ResourceAttached = "ATTACHED" - ResourceAttaching = "ATTACHING" - ResourceAvailable = "AVAILABLE" - ResourceCreated = "CREATED" - ResourceCreating = "CREATING" - ResourceCreatingImage = "CREATING_IMAGE" - ResourceDeleting = "DELETING" - ResourceDeleted = "DELETED" - ResourceDetached = "DETACHED" - ResourceDetaching = "DETACHING" - ResourceDisabled = "DISABLED" - ResourceDown = "DOWN" - ResourceDownForMaintenance = "DOWN_FOR_MAINTENANCE" - ResourceFailed = "FAILED" - ResourceFaulty = "FAULTY" - ResourceGettingHistory = "GETTING-HISTORY" - ResourceInactive = "INACTIVE" - ResourceProvisioning = "PROVISIONING" - ResourceRequested = "REQUESTED" - ResourceRequestReceived = "REQUEST_RECEIVED" - ResourceRestoring = "RESTORING" - ResourceRunning = "RUNNING" - ResourceStarting = "STARTING" - ResourceStopped = "STOPPED" - ResourceStopping = "STOPPING" - ResourceSucceeded = "SUCCEEDED" - ResourceTerminated = "TERMINATED" - ResourceTerminating = "TERMINATING" - ResourceUp = "UP" + ResourceActive = "ACTIVE" + ResourceAttached = "ATTACHED" + ResourceAttaching = "ATTACHING" + ResourceAvailable = "AVAILABLE" + ResourceCreated = "CREATED" + ResourceCreating = "CREATING" + ResourceCreatingImage = "CREATING_IMAGE" + ResourceDeleting = "DELETING" + ResourceDeleted = "DELETED" + ResourceDetached = "DETACHED" + ResourceDetaching = "DETACHING" + ResourceDisabled = "DISABLED" + ResourceDown = "DOWN" + ResourceDownForMaintenance = "DOWN_FOR_MAINTENANCE" + ResourceFailed = "FAILED" + ResourceFaulty = "FAULTY" + ResourceGettingHistory = "GETTING-HISTORY" + ResourceInactive = "INACTIVE" + ResourceProvisioning = "PROVISIONING" + ResourceRequested = "REQUESTED" + ResourceRequestReceived = "REQUEST_RECEIVED" + ResourceRestoring = "RESTORING" + ResourceRunning = "RUNNING" + ResourceStarting = "STARTING" + ResourceStopped = "STOPPED" + ResourceStopping = "STOPPING" + ResourceSucceeded = "SUCCEEDED" + ResourceTerminated = "TERMINATED" + ResourceTerminating = "TERMINATING" + ResourceUp = "UP" + ResourceWaitingForWorkRequest = "WAITING_FOR_WORK_REQUEST" + ResourceSucceededWorkRequest = "SUCCEEDED_WORK_REQUEST" + + WorkRequestAccepted = "ACCEPTED" + WorkRequestInProgress = "IN_PROGRESS" + WorkRequestFailed = "FAILED" + WorkRequestSucceeded = "SUCCEEDED" // Error codes UserAlreadyExists = "UserAlreadyExists" @@ -78,6 +85,7 @@ const ( headerETag = "ETag" headerLastModified = "last-modified" headerOPCClientRequestID = "opc-client-request-id" + headerOPCWorkRequestID = "opc-work-request-id" headerOPCNextPage = "opc-next-page" headerOPCRequestID = "opc-request-id" @@ -147,6 +155,19 @@ const ( resourceVolumeAttachments resourceName = "volumeAttachments" resourceVolumeBackups resourceName = "volumeBackups" + // LoadBalancer Resources + resourceLoadBalancers resourceName = "loadBalancers" + resourceBackends resourceName = "backends" + resourceBackendSets resourceName = "backendSets" + resourceCertificates resourceName = "certificates" + resourceHealthChecker resourceName = "healthChecker" + resourceListeners resourceName = "listeners" + resourceLoadBalancerPolicies resourceName = "loadBalancerPolicies" + resourceLoadBalancerProtocols resourceName = "loadBalancerProtocols" + resourceLoadBalancerShapes resourceName = "loadBalancerShapes" + resourceLoadBalancerWorkRequests resourceName = "loadBalancerWorkRequests" + resourceWorkRequests resourceName = "workRequests" + apiKeys = "apiKeys" uiPassword = "uiPassword" deviceConfig = "deviceConfig" diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/core_security_list.go b/vendor/github.com/MustWin/baremetal-sdk-go/core_security_list.go index 0914b8791ae..5dd6a70fe68 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/core_security_list.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/core_security_list.go @@ -43,6 +43,7 @@ type IngressSecurityRule struct { Source string `header:"-" json:"source" url:"-"` TCPOptions *TCPOptions `header:"-" json:"tcpOptions,omitempty" url:"-"` UDPOptions *UDPOptions `header:"-" json:"udpOptions,omitempty" url:"-"` + IsStateless bool `header:"-" json:"isStateless" url:"-"` } // EgressSecurityRule is a rule for allowing outbound IP packets. diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/core_subnet.go b/vendor/github.com/MustWin/baremetal-sdk-go/core_subnet.go index db4d779e4e8..7fe6690dbf0 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/core_subnet.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/core_subnet.go @@ -11,19 +11,19 @@ type Subnet struct { OPCRequestIDUnmarshaller ETagUnmarshaller AvailabilityDomain string `json:"availabilityDomain"` - CIDRBlock string `json:"cidrBlock"` - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` + CIDRBlock string `json:"cidrBlock"` + CompartmentID string `json:"compartmentId"` + DisplayName string `json:"displayName"` DHCPOptionsID string `json:"dhcpOptionsId"` DNSLabel string `json:"dnsLabel"` - ID string `json:"id"` - RouteTableID string `json:"routeTableId"` - SecurityListIDs []string `json:"securityListIds"` - State string `json:"lifecycleState"` - TimeCreated Time `json:"timeCreated"` - VcnID string `json:"vcnId"` - VirtualRouterIP string `json:"virtualRouterIp"` - VirtualRouterMac string `json:"virtualRouterMac"` + ID string `json:"id"` + RouteTableID string `json:"routeTableId"` + SecurityListIDs []string `json:"securityListIds"` + State string `json:"lifecycleState"` + TimeCreated Time `json:"timeCreated"` + VcnID string `json:"vcnId"` + VirtualRouterIP string `json:"virtualRouterIp"` + VirtualRouterMac string `json:"virtualRouterMac"` } // ListSubnets contains a list of Subnet diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backend.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backend.go new file mode 100644 index 00000000000..e1aa094372a --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backend.go @@ -0,0 +1,180 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +import ( + "net/http" +) + +// Backend defines a backend server that is a member of a load balancer backend set. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Backend/ +// Also https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/requests/BackendDetails +type Backend struct { + OPCRequestIDUnmarshaller + OPCWorkRequestIDUnmarshaller + Backup bool `json:"backup"` + Drain bool `json:"drain"` + IPAddress string `json:"ipAddress"` + Name string `json:"name"` + Offline bool `json:"offline"` + Port int `json:"port"` + Weight int `json:"weight"` +} + +// ListBackends contains a list of backends +// +type ListBackends struct { + OPCRequestIDUnmarshaller + Backends []Backend +} + +func (l *ListBackends) GetList() interface{} { + return &l.Backends +} + +// CreateBackend Adds a backend server to a backend set. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Backend/CreateBackend +func (c *Client) CreateBackend( + loadBalancerID string, + backendSetName string, + ipAddr string, + port int, + opts *CreateLoadBalancerBackendOptions, +) (workRequestID string, e error) { + + required := struct { + IPAddr string `header:"-" json:"ipAddress" url:"-"` + Port int `header:"-" json:"port" url:"-"` + }{ + IPAddr: ipAddr, + Port: port, + } + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, resourceBackendSets, backendSetName}, + optional: opts, + required: required, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodPost, details); e != nil { + return + } + + backend := &Backend{} + e = resp.unmarshal(backend) + if e == nil { + workRequestID = backend.WorkRequestID + } + return +} + +// GetBackend Gets the specified backend server's configuration information. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Backend/GetBackend +func (c *Client) GetBackend( + loadBalancerID string, + backendSetName string, + backendName string, + opts *ClientRequestOptions, +) (backend *Backend, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName, + resourceBackends, backendName}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + backend = &Backend{} + e = resp.unmarshal(backend) + return +} + +// ListBackend Lists the backend servers for a given load balancer and backend set. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Backend/ListBackends +func (c *Client) ListBackends( + loadBalancerID string, + backendSetName string, +) (backends *ListBackends, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName, resourceBackends}, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + backends = &ListBackends{} + e = resp.unmarshal(backends) + return +} + +// UpdateBackend Updates the configuration of a backend server within the specified backend set. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Backend/UpdateBackend +func (c *Client) UpdateBackend( + loadBalancerID string, + backendSetName string, + backendName string, + opts *CreateLoadBalancerBackendOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName, + resourceBackends, backendName}, + optional: opts, + } + + var resp *response + if resp, e = c.objectStorageApi.request(http.MethodPut, details); e != nil { + return + } + + backend := &Backend{} + e = resp.unmarshal(backend) + if e == nil { + workRequestID = backend.WorkRequestID + } + return +} + +// DeleteBackend Removes a backend server from a given load balancer and backend set. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Backend/DeleteBackend +func (c *Client) DeleteBackend( + loadBalancerID string, + backendSetName string, + backendName string, + opts *ClientRequestOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName, + resourceBackends, backendName}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodDelete, details); e != nil { + return + } + + backend := &Backend{} + e = resp.unmarshal(backend) + if e == nil { + workRequestID = backend.WorkRequestID + } + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backendset.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backendset.go new file mode 100644 index 00000000000..edbbd6acf49 --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backendset.go @@ -0,0 +1,182 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +import ( + "net/http" +) + +// BackendSet defines the configuration of a load balancer backend set. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/ +type BackendSet struct { + OPCRequestIDUnmarshaller + OPCWorkRequestIDUnmarshaller + Backends []Backend `json:"backends"` + HealthChecker HealthChecker `json:"healthChecker"` + Name string `json:"name,omitempty"` // Only on create + Policy string `json:"policy"` + SSLConfig SSLConfiguration `json:"sslConfiguration"` +} + +type SSLConfiguration struct { + CertificateName string `json:"certificateName"` + VerifyDepth int `json:"verifyDepth"` + VerifyPeerCertificate bool `json:"verifyPeerCertificate"` +} + +// ListBackendSets contains a list of backend Sets +// +type ListBackendSets struct { + OPCRequestIDUnmarshaller + BackendSets []BackendSet +} + +func (l *ListBackendSets) GetList() interface{} { + return &l.BackendSets +} + +// CreateBackendSet Adds a backend set to a load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/CreateBackendSet +func (c *Client) CreateBackendSet( + loadBalancerID string, + name string, + policy string, + backends []Backend, + healthChecker HealthChecker, + sslConfig SSLConfiguration, + opts *LoadBalancerOptions, +) (workRequestID string, e error) { + + required := BackendSet{ + Name: name, + Policy: policy, + SSLConfig: sslConfig, + HealthChecker: healthChecker, + Backends: backends, + } + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, resourceBackendSets}, + optional: opts, + required: required, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodPost, details); e != nil { + return + } + + backendset := &BackendSet{} + e = resp.unmarshal(backendset) + if e == nil { + workRequestID = backendset.WorkRequestID + } + return +} + +// GetBackendSet Gets the specified backend set's configuration information. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/GetBackendSet +func (c *Client) GetBackendSet( + loadBalancerID string, + backendSetName string, + opts *ClientRequestOptions, +) (backendset *BackendSet, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + backendset = &BackendSet{} + e = resp.unmarshal(backendset) + return +} + +// ListBackendSets Lists all backend sets associated with a given load balancer. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/ListBackendSets +func (c *Client) ListBackendSets( + loadBalancerID string, + opts *ClientRequestOptions, +) (backends *ListBackendSets, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets}, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + backends = &ListBackendSets{} + e = resp.unmarshal(backends) + return +} + +// TODO: Determine if any parameters to the load balancer API are optional. + +// UpdateBackendSet Updates a backend set. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/UpdateBackendSet +func (c *Client) UpdateBackendSet( + loadBalancerID string, + backendSetName string, + opts *UpdateLoadBalancerBackendSetOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName}, + optional: opts, + } + + var resp *response + if resp, e = c.objectStorageApi.request(http.MethodPut, details); e != nil { + return + } + + backendset := &BackendSet{} + e = resp.unmarshal(backendset) + if e == nil { + workRequestID = backendset.WorkRequestID + } + return +} + +// Deletes the specified backend set. Note that deleting a backend set removes its backend servers from the load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/DeleteBackendSet +func (c *Client) DeleteBackendSet( + loadBalancerID string, + backendSetName string, + opts *ClientRequestOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodDelete, details); e != nil { + return + } + + backendset := &BackendSet{} + e = resp.unmarshal(backendset) + + if e == nil { + workRequestID = backendset.WorkRequestID + } + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_certificate.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_certificate.go new file mode 100644 index 00000000000..fe7dc9c2adb --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_certificate.go @@ -0,0 +1,123 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +import ( + "net/http" +) + +// Certificate defines a listener certificate bundle. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Certificate/ +// Also https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/requests/CertificateDetails +type Certificate struct { + OPCRequestIDUnmarshaller + OPCWorkRequestIDUnmarshaller + CACertificate string `header:"-" url:"-" json:"caCertificate"` + CertificateName string `header:"-" url:"-" json:"certificateName"` + PublicCertificate string `header:"-" url:"-" json:"publicCertificate"` + Passphrase string `header:"-" url:"-" json:"passphrase,omitempty"` // Only for create + PrivateKey string `header:"-" url:"-" json:"privateKey,omitempty"` // Only for create +} + +// ListCertificates contains a list of certificates +// +type ListCertificates struct { + OPCRequestIDUnmarshaller + Certificates []Certificate +} + +func (l *ListCertificates) GetList() interface{} { + return &l.Certificates +} + +// CreateBackendSet Adds a backend set to a load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/CreateBackendSet +func (c *Client) CreateCertificate( + loadBalancerID string, + certificateName string, + caCertificate string, + privateKey string, + passphrase string, + publicCertificate string, + opts *LoadBalancerOptions, +) (workRequestID string, e error) { + + required := Certificate{ + CACertificate: caCertificate, + CertificateName: certificateName, + PublicCertificate: publicCertificate, + Passphrase: passphrase, + PrivateKey: privateKey, + } + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, resourceCertificates}, + optional: opts, + required: required, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodPost, details); e != nil { + return + } + + cert := &Certificate{} + e = resp.unmarshal(cert) + if e == nil { + workRequestID = cert.WorkRequestID + } + return +} + +// ListCertificates Lists all SSL certificates associated with a given load balancer. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Certificate/ListCertificates +func (c *Client) ListCertificates( + loadBalancerID string, + opts *ClientRequestOptions, +) (certs *ListCertificates, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceCertificates}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + certs = &ListCertificates{} + e = resp.unmarshal(certs) + return +} + +// Deletes the specified backend set. Note that deleting a backend set removes its backend servers from the load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/DeleteBackendSet +func (c *Client) DeleteCertificate( + loadBalancerID string, + certificateName string, + opts *ClientRequestOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceCertificates, certificateName}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodDelete, details); e != nil { + return + } + + cert := &Certificate{} + e = resp.unmarshal(cert) + if e == nil { + workRequestID = cert.WorkRequestID + } + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_healthchecker.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_healthchecker.go new file mode 100644 index 00000000000..56d0c27e460 --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_healthchecker.go @@ -0,0 +1,78 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +import ( + "net/http" +) + +// The health check policy configuration. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/HealthChecker/ +// Also https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/requests/HealthCheckerDetails +type HealthChecker struct { + OPCRequestIDUnmarshaller + OPCWorkRequestIDUnmarshaller + IntervalInMS int `url:"-" header:"-" json:"intervalInMillis,omitempty"` + Port int `url:"-" header:"-" json:"port,omitempty"` + Protocol string `url:"-" header:"-" json:"protocol,omitempty"` + ResponseBodyRegex string `url:"-" header:"-" json:"responseBodyRegex,omitempty"` + Retries int `url:"-" header:"-" json:"retries,omitempty"` + ReturnCode int `url:"-" header:"-" json:"returnCode,omitempty"` + TimeoutInMS int `url:"-" header:"-" json:"timeoutInMillis,omitempty"` + URLPath string `url:"-" header:"-" json:"urlPath,omitempty"` +} + +// GetHealthChecker Gets the health check policy information for a given load balancer and backend set. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/HealthChecker/GetHealthChecker +func (c *Client) GetHealthChecker( + loadBalancerID string, + backendSetName string, + opts *ClientRequestOptions, +) (healthChecker *HealthChecker, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName, resourceHealthChecker}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + healthChecker = &HealthChecker{} + e = resp.unmarshal(healthChecker) + return +} + +// UpdateHealthChecker Updates the health check policy for a given load balancer and backend set. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/HealthChecker/UpdateHealthChecker +func (c *Client) UpdateHealthChecker( + loadBalancerID string, + backendSetName string, + healthCheckerOptions HealthChecker, // TODO: confirm that all fields are optional + opts *LoadBalancerOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName}, + required: healthCheckerOptions, + optional: opts, + } + + var resp *response + if resp, e = c.objectStorageApi.request(http.MethodPut, details); e != nil { + return + } + + healthChecker := &HealthChecker{} + e = resp.unmarshal(healthChecker) + if e == nil { + workRequestID = healthChecker.WorkRequestID + } + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_listener.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_listener.go new file mode 100644 index 00000000000..31819d03506 --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_listener.go @@ -0,0 +1,118 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +import ( + "net/http" +) + +// Listener defines a listener's configuration details. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/requests/ListenerDetails +type Listener struct { + OPCRequestIDUnmarshaller + OPCWorkRequestIDUnmarshaller + DefaultBackendSetName string `json:"defaultBackendSetName"` + Name string `json:"name,omitempty"` // Only for create + Port int `json:"port"` + Protocol string `json:"protocol"` + SSLConfig SSLConfiguration `json:"sslConfiguration"` +} + +// CreateListener Adds a listener to a load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Listener/CreateListener +func (c *Client) CreateListener( + loadBalancerID string, + name string, + defaultBackendSetName string, + protocol string, + port int, + sslConfig SSLConfiguration, + opts *LoadBalancerOptions, +) (workRequestID string, e error) { + + required := Listener{ + Name: name, + DefaultBackendSetName: defaultBackendSetName, + Protocol: protocol, + Port: port, + SSLConfig: sslConfig, + } + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, resourceListeners}, + optional: opts, + required: required, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodPost, details); e != nil { + return + } + + listener := &Listener{} + e = resp.unmarshal(listener) + if e == nil { + workRequestID = listener.WorkRequestID + } + return +} + +// TODO: Determine if any parameters to the load balancer API are optional. + +// UpdateListener Updates a listener for a given load balancer. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Listener/UpdateListener +func (c *Client) UpdateListener( + loadBalancerID string, + listenerName string, + opts *UpdateLoadBalancerListenerOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceListeners, listenerName}, + optional: opts, + } + + var resp *response + if resp, e = c.objectStorageApi.request(http.MethodPut, details); e != nil { + return + } + + listener := &Listener{} + e = resp.unmarshal(listener) + if e == nil { + workRequestID = listener.WorkRequestID + } + return +} + +// Deletes a listener from a load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Listener/DeleteListener +func (c *Client) DeleteListener( + loadBalancerID string, + listenerName string, + opts *ClientRequestOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceListeners, listenerName}, + optional: opts, + } + + var resp *response + if resp, e = c.objectStorageApi.request(http.MethodDelete, details); e != nil { + return + } + + listener := &Listener{} + e = resp.unmarshal(listener) + if e == nil { + workRequestID = listener.WorkRequestID + } + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_loadbalancer.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_loadbalancer.go new file mode 100644 index 00000000000..1a9db98848a --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_loadbalancer.go @@ -0,0 +1,171 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +import ( + "net/http" +) + +// LoadBalancer defines a Load Balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancer/ +type LoadBalancer struct { + OPCRequestIDUnmarshaller + OPCWorkRequestIDUnmarshaller + BackendSets []BackendSet `json:"backendSets"` + Certificates Certificate `json:"certificates"` // TODO: confirm this is not an array + CompartmentID string `json:"compartmentId"` + DisplayName string `json:"displayName"` + ID string `json:"id"` + IPAddresses []string `json:"ipAddresses"` + Listeners Listener `json:"listeners"` // TODO: confirm this is not an array + Shape string `json:"shapeName"` + State string `json:"lifecycleState"` + SubnetIDs []string `json:"subnetIds"` + TimeCreated Time `json:"timeCreated"` +} + +// ListLoadBalancers contains a list of load balancers. +type ListLoadBalancers struct { + OPCRequestIDUnmarshaller + NextPageUnmarshaller + LoadBalancers []LoadBalancer +} + +func (l *ListLoadBalancers) GetList() interface{} { + return &l.LoadBalancers +} + +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/requests/CreateLoadBalancerDetails +type CreateLoadBalancerDetails struct { + ocidRequirement + BackendSets *BackendSet `header:"-" json:"backendSets,omitempty" url:"-"` + Certificates *Certificate `header:"-" json:"certificates,omitempty" url:"-"` + Listeners *Listener `header:"-" json:"listeners,omitempty" url:"-"` + Shape string `header:"-" json:"shapeName,omitempty" url:"-"` + SubnetIDs []string `header:"-" json:"subnetIds,omitempty" url:"-"` +} + +// CreateLoadBalancer creates a new load balancer in the specified compartment. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancer/CreateLoadBalancer +func (c *Client) CreateLoadBalancer( + backendSets *BackendSet, + certificates *Certificate, + compartmentID string, + listeners *Listener, + shape string, + subnetIDs []string, + opts *CreateOptions) (workRequestID string, e error) { + + required := CreateLoadBalancerDetails{ + BackendSets: backendSets, + Certificates: certificates, + Listeners: listeners, + Shape: shape, + SubnetIDs: subnetIDs, + } + required.CompartmentID = compartmentID + + details := &requestDetails{ + name: resourceLoadBalancers, + optional: opts, + required: required, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodPost, details); e != nil { + return + } + + loadbalancer := &LoadBalancer{} + e = resp.unmarshal(loadbalancer) + if e == nil { + workRequestID = loadbalancer.WorkRequestID + } + return +} + +// GetLoadBalancer gets the specified load balancer's configuration information. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancer/GetLoadBalancer +func (c *Client) GetLoadBalancer(id string, opts *ClientRequestOptions) (loadbalancer *LoadBalancer, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, id}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + loadbalancer = &LoadBalancer{} + e = resp.unmarshal(loadbalancer) + return +} + +// ListLoadBalancers lists all load balancers in the specified compartment. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancer/ListLoadBalancers +func (c *Client) ListLoadBalancers(compartmentID string, opts *ListOptions) (loadbalancers *ListLoadBalancers, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers}, + required: listOCIDRequirement{CompartmentID: compartmentID}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + loadbalancers = &ListLoadBalancers{} + e = resp.unmarshal(loadbalancers) + return +} + +// UpdateLoadBalancer updates a load balancer's configuration. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancer/UpdateLoadBalancer +func (c *Client) UpdateLoadBalancer(id string, opts *UpdateOptions) (workRequestID string, e error) { + // TODO: Determine if any parameters to the load balancer API are optional. + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, id}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodPut, details); e != nil { + return + } + + loadbalancer := &LoadBalancer{} + e = resp.unmarshal(loadbalancer) + if e == nil { + workRequestID = loadbalancer.WorkRequestID + } + return +} + +// DeleteLoadBalancer stops a load balancer and removes it from service. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancer/DeleteLoadBalancer +func (c *Client) DeleteLoadBalancer(id string, opts *ClientRequestOptions) (workRequestID string, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, id}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodDelete, details); e != nil { + return + } + + loadbalancer := &LoadBalancer{} + e = resp.unmarshal(loadbalancer) + if e == nil { + workRequestID = loadbalancer.WorkRequestID + } + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_policy.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_policy.go new file mode 100644 index 00000000000..4b856dec6b6 --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_policy.go @@ -0,0 +1,50 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +// The properties that define a load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancerPolicies/ + +type LoadBalancerPolicy struct { + Name string `json:"name"` +} + +// ListLoadBalancerPolicies contains a list of backend policies +// +type ListLoadBalancerPolicies struct { + OPCRequestIDUnmarshaller + LoadBalancerPolicies []LoadBalancerPolicy +} + +func (l *ListLoadBalancerPolicies) GetList() interface{} { + return &l.LoadBalancerPolicies +} + +// ListLoadBalancerPolicies Lists the available load balancer policies. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancerPolicy/ListPolicies +func (c *Client) ListLoadBalancerPolicies( + compartmentID string, + opts *ListLoadBalancerPolicyOptions, +) (loadbalancerPolicies *ListLoadBalancerPolicies, e error) { + required := struct { + CompartmentID string `header:"-" json:"-" url:"compartmentId,omitempty"` + }{ + CompartmentID: compartmentID, + } + details := &requestDetails{ + ids: urlParts{resourceLoadBalancerPolicies}, + required: required, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + loadbalancerPolicies = &ListLoadBalancerPolicies{} + e = resp.unmarshal(loadbalancerPolicies) + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_protocol.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_protocol.go new file mode 100644 index 00000000000..d617e522e8f --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_protocol.go @@ -0,0 +1,50 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +// The properties that define a load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancerProtocols/ + +type LoadBalancerProtocol struct { + Name string `json:"name"` +} + +// ListLoadBalancerProtocols contains a list of protocols +// +type ListLoadBalancerProtocols struct { + OPCRequestIDUnmarshaller + LoadBalancerProtocols []LoadBalancerProtocol +} + +func (l *ListLoadBalancerProtocols) GetList() interface{} { + return &l.LoadBalancerProtocols +} + +// ListLoadBalancerProtocols Lists the available load balancer policies. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancerPolicy/ListProtocols +func (c *Client) ListLoadBalancerProtocols( + compartmentID string, + opts *ListLoadBalancerPolicyOptions, +) (loadbalancerProtocols *ListLoadBalancerProtocols, e error) { + required := struct { + CompartmentID string `header:"-" json:"-" url:"compartmentId,omitempty"` + }{ + CompartmentID: compartmentID, + } + details := &requestDetails{ + ids: urlParts{resourceLoadBalancerProtocols}, + required: required, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + loadbalancerProtocols = &ListLoadBalancerProtocols{} + e = resp.unmarshal(loadbalancerProtocols) + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_shape.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_shape.go new file mode 100644 index 00000000000..007fdbf740e --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_shape.go @@ -0,0 +1,51 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +// TA shape is a template that determines the total pre-provisioned bandwidth (ingress plus egress) for the load balancer. +// Note that the pre-provisioned maximum capacity applies to aggregated connections, not to a single client attempting to use the full bandwidth. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancerShape/ + +type LoadBalancerShape struct { + Name string `json:"name"` +} + +// ListLoadBalancerShapes contains a list of shapes +// +type ListLoadBalancerShapes struct { + OPCRequestIDUnmarshaller + LoadBalancerShapes []LoadBalancerShape +} + +func (l *ListLoadBalancerShapes) GetList() interface{} { + return &l.LoadBalancerShapes +} + +// ListLoadBalancerShapes Lists the valid load balancer shapes. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancerShape/ListShapes +func (c *Client) ListLoadBalancerShapes( + compartmentID string, + opts *ListLoadBalancerPolicyOptions, +) (loadbalancerShapes *ListLoadBalancerShapes, e error) { + required := struct { + CompartmentID string `header:"-" json:"-" url:"compartmentId,omitempty"` + }{ + CompartmentID: compartmentID, + } + details := &requestDetails{ + name: resourceLoadBalancerShapes, + required: required, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + loadbalancerShapes = &ListLoadBalancerShapes{} + e = resp.unmarshal(loadbalancerShapes) + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_workrequest.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_workrequest.go new file mode 100644 index 00000000000..debb6a61bf0 --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_workrequest.go @@ -0,0 +1,89 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +import ( + "time" +) + +// Many of the API requests you use to create and configure load balancing do not take effect +// immediately. In these cases, the request spawns an asynchronous work flow to fulfill the request. +// WorkRequest objects provide visibility for in-progress work flows. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/WorkRequest/ + +type WorkRequest struct { + OPCRequestIDUnmarshaller + OPCWorkRequestIDUnmarshaller + ID string `json:"id"` + ErrorDetails []WorkRequestError + State string `json:"lifecycleState"` + LoadBalancerID string `json:"loadBalancerId"` + Message string `json:"message"` + TimeAccepted time.Time `json:"timeAccepted"` + TimeFinished time.Time `json:"timeFinished"` + Type string `json:"type"` +} + +type WorkRequestError struct { + ErrorCode string `json:"errorCode"` + Message string `json:"message"` +} + +// ListWorkRequest contains a list of backend Sets +// +type ListWorkRequests struct { + OPCRequestIDUnmarshaller + NextPageUnmarshaller + WorkRequests []WorkRequest +} + +func (l *ListWorkRequests) GetList() interface{} { + return &l.WorkRequests +} + +// GetWorkRequest Gets the details of a work request. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/WorkRequest/GetWorkRequest +func (c *Client) GetWorkRequest( + workRequestID string, + opts *ClientRequestOptions, +) (workRequest *WorkRequest, e error) { + details := &requestDetails{ + name: resourceLoadBalancerWorkRequests, + ids: urlParts{workRequestID}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + workRequest = &WorkRequest{} + e = resp.unmarshal(workRequest) + return +} + +// ListWorkRequests Lists the work requests for a given load balancer. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/ListWorkRequest +func (c *Client) ListWorkRequests( + loadBalancerID string, + opts *ListLoadBalancerPolicyOptions, +) (workRequests *ListWorkRequests, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceWorkRequests}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + workRequests = &ListWorkRequests{} + e = resp.unmarshal(workRequests) + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go b/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go index 3d034b15b8c..411d4d33a65 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go @@ -61,6 +61,53 @@ type CreateSubnetOptions struct { SecurityListIDs []string `header:"-" json:"securityListIds,omitempty" url:"-"` } +type LoadBalancerOptions struct { + ClientRequestOptions + RetryTokenOptions +} + +type CreateLoadBalancerBackendOptions struct { + LoadBalancerOptions + Backup bool `header:"-" json:"backup,omitempty", url:"-"` + Drain bool `header:"-" json:"drain,omitempty", url:"-"` + Offline bool `header:"-" json:"offline,omitempty", url:"-"` + Weight int `header:"-" json:"weight,omitempty", url:"-"` +} + +type UpdateLoadBalancerBackendSetOptions struct { + LoadBalancerOptions + RetryTokenOptions + Backends []Backend `header:"-" json:"backends,omitempty" url:"-"` + HealthChecker HealthChecker `header:"-" json:"healthChecker,omitempty" url:"-"` + Policy string `header:"-" json:"policy,omitempty" url:"-"` + SSLConfig SSLConfiguration `header:"-" json:"sslConfiguration,omitempty" url:"-"` +} + +type UpdateLoadBalancerListenerOptions struct { + LoadBalancerOptions + DefaultBackendSetName string `header:"-" json:"defaultBackendSetName" url:"-"` + Port int `header:"-" json:"port" url:"-"` + Protocol string `header:"-" json:"protocol" url:"-"` + SSLConfig SSLConfiguration `header:"-" json:"sslConfiguration" url:"-"` +} + +type ListLoadBalancerPolicyOptions struct { + ClientRequestOptions + ListOptions +} + +type ListLoadBalancerOptions struct { + ClientRequestOptions + ListOptions + CompartmentID string `header:"-" json:"-" url:"compartmentId,omitempty"` + Detail string `header:"-" json:"-" url:"detail,omitempty"` +} + +type UpdateLoadBalancerOptions struct { + LoadBalancerOptions + DisplayNameOptions +} + type CreateVolumeOptions struct { CreateOptions SizeInMBs int `header:"-" json:"sizeInMBs,omitempty" url:"-"` diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/requestor.go b/vendor/github.com/MustWin/baremetal-sdk-go/requestor.go index b065d63f210..d40392c231e 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/requestor.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/requestor.go @@ -116,6 +116,10 @@ func (api *apiRequestor) request(method string, reqOpts request) (r *response, e if e = createAuthorizationHeader(req, api.authInfo, api.userAgent, jsonBuffer); e != nil { return } + if e != nil { + log.Printf("[WARN] Could not get HTTP authorization header, error: %#v\n", e) + return + } if os.Getenv("DEBUG") != "" { reqdump, err := httputil.DumpRequestOut(req, true) @@ -128,12 +132,12 @@ func (api *apiRequestor) request(method string, reqOpts request) (r *response, e var resp *http.Response resp, e = api.httpClient.Do(req) + if e != nil { + log.Printf("[WARN] Could not get HTTP Response, error: %#v\n", e) + return + } if os.Getenv("DEBUG") != "" { - if e != nil { - log.Printf("[WARN] Could not dump HTTP Response, error: %#v\n", e) - return - } respdump, err := httputil.DumpResponse(resp, true) if err == nil { log.Printf("[DEBUG] HTTP Response: %v\n", string(respdump)) diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/response.go b/vendor/github.com/MustWin/baremetal-sdk-go/response.go index 746dfec802a..a708a1a1e59 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/response.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/response.go @@ -31,6 +31,8 @@ func (r *response) unmarshal(resource interface{}) (e error) { if e = cs.SetBody(r.body, val); e != nil { return } + } else if len(r.body) == 0 { + // Continue without error. This is usually caused by a 204 response } else if e = json.Unmarshal(r.body, val); e != nil { return } @@ -43,6 +45,10 @@ func (r *response) unmarshal(resource interface{}) (e error) { crr.SetClientRequestID(r.header.Get(headerOPCClientRequestID)) } + if wrr, ok := resource.(OPCWorkRequestIDUnmarshallable); ok { + wrr.SetWorkRequestID(r.header.Get(headerOPCWorkRequestID)) + } + if et, ok := resource.(ETagUnmarshallable); ok { et.SetETag(r.header.Get(headerETag)) } diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/response_unmarshallers.go b/vendor/github.com/MustWin/baremetal-sdk-go/response_unmarshallers.go index aaba94f7128..44ad8edac13 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/response_unmarshallers.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/response_unmarshallers.go @@ -57,6 +57,18 @@ func (r *OPCClientRequestIDUnmarshaller) SetClientRequestID(id string) { r.ClientRequestID = id } +type OPCWorkRequestIDUnmarshallable interface { + SetWorkRequestID(id string) +} + +type OPCWorkRequestIDUnmarshaller struct { + WorkRequestID string +} + +func (r *OPCWorkRequestIDUnmarshaller) SetWorkRequestID(id string) { + r.WorkRequestID = id +} + type LastModifiedUnmarshallable interface { SetLastModified(time.Time) } diff --git a/vendor/vendor.json b/vendor/vendor.json index 863bc4e4906..2a52c440c3b 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -315,10 +315,10 @@ "revisionTime": "2017-02-01T00:43:30Z" }, { - "checksumSHA1": "7GKnXxA76DCy9yAEfb4TtTHSCmw=", + "checksumSHA1": "poKBZQ8AFlXGB1cUjeIUptVtrmM=", "path": "github.com/MustWin/baremetal-sdk-go", - "revision": "1a01267edea6079aa1311d09e1f53a5c924a7ce0", - "revisionTime": "2017-04-02T00:38:36Z" + "revision": "90056d2a697d91f59e355ed698b1150bb23e19b9", + "revisionTime": "2017-04-04T04:32:14Z" }, { "checksumSHA1": "Aqy8/FoAIidY/DeQ5oTYSZ4YFVc=", From ee2d09c5e76a1f6d4d7667b25189b3a8f376ed17 Mon Sep 17 00:00:00 2001 From: Mike Ihbe Date: Mon, 3 Apr 2017 22:11:47 -0700 Subject: [PATCH 04/14] Fix VirtualRouterIP name --- core/subnet_datasource.go | 2 +- core/subnet_datasource_crud.go | 2 +- core_subnet_datasource_test.go | 12 ++++++------ core_subnet_test.go | 4 ++-- vendor/vendor.json | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/core/subnet_datasource.go b/core/subnet_datasource.go index 73f6cc9c5b3..479f7ede4ee 100644 --- a/core/subnet_datasource.go +++ b/core/subnet_datasource.go @@ -83,7 +83,7 @@ func resourceCoreSubnets() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "virtual_router_id": { + "virtual_router_ip": { Type: schema.TypeString, Computed: true, }, diff --git a/core/subnet_datasource_crud.go b/core/subnet_datasource_crud.go index bccc42eaa45..a7410f1d1ad 100644 --- a/core/subnet_datasource_crud.go +++ b/core/subnet_datasource_crud.go @@ -59,7 +59,7 @@ func (s *SubnetDatasourceCrud) SetData() { "id": v.ID, "state": v.State, "time_created": v.TimeCreated.String(), - "virtual_router_id": v.VirtualRouterID, + "virtual_router_ip": v.VirtualRouterIP, "virtual_router_mac": v.VirtualRouterMac, } resources = append(resources, res) diff --git a/core_subnet_datasource_test.go b/core_subnet_datasource_test.go index 80c0684d603..a685de2bea4 100644 --- a/core_subnet_datasource_test.go +++ b/core_subnet_datasource_test.go @@ -70,7 +70,7 @@ func (s *ResourceCoreSubnetsTestSuite) TestResourceListSubnets() { Time: time.Now(), }, VcnID: "vcnid", - VirtualRouterID: "virtualrouterid", + VirtualRouterIP: "virtualrouterip", VirtualRouterMac: "virtualroutermac", }, { @@ -89,7 +89,7 @@ func (s *ResourceCoreSubnetsTestSuite) TestResourceListSubnets() { Time: time.Now(), }, VcnID: "vcnid", - VirtualRouterID: "virtualrouterid", + VirtualRouterIP: "virtualrouterip", VirtualRouterMac: "virtualroutermac", }, }, @@ -141,7 +141,7 @@ func (s *ResourceCoreSubnetsTestSuite) TestResourceListSubnetsWithPagination() { Time: time.Now(), }, VcnID: "vcnid", - VirtualRouterID: "virtualrouterid", + VirtualRouterIP: "virtualrouterip", VirtualRouterMac: "virtualroutermac", }, { @@ -160,7 +160,7 @@ func (s *ResourceCoreSubnetsTestSuite) TestResourceListSubnetsWithPagination() { Time: time.Now(), }, VcnID: "vcnid", - VirtualRouterID: "virtualrouterid", + VirtualRouterIP: "virtualrouterip", VirtualRouterMac: "virtualroutermac", }, } @@ -198,7 +198,7 @@ func (s *ResourceCoreSubnetsTestSuite) TestResourceListSubnetsWithPagination() { Time: time.Now(), }, VcnID: "vcnid", - VirtualRouterID: "virtualrouterid", + VirtualRouterIP: "virtualrouterip", VirtualRouterMac: "virtualroutermac", }, { @@ -217,7 +217,7 @@ func (s *ResourceCoreSubnetsTestSuite) TestResourceListSubnetsWithPagination() { Time: time.Now(), }, VcnID: "vcnid", - VirtualRouterID: "virtualrouterid", + VirtualRouterIP: "virtualrouterip", VirtualRouterMac: "virtualroutermac", }, }, diff --git a/core_subnet_test.go b/core_subnet_test.go index 76ea6b5ce08..9cf5750918a 100644 --- a/core_subnet_test.go +++ b/core_subnet_test.go @@ -73,7 +73,7 @@ func (s *ResourceCoreSubnetTestSuite) SetupTest() { Time: time.Now(), }, VcnID: "vcnid", - VirtualRouterID: "virtualrouterid", + VirtualRouterIP: "virtualrouterip", VirtualRouterMac: "virtualroutermac", } @@ -191,7 +191,7 @@ func (s ResourceCoreSubnetTestSuite) TestUpdateCompartmentIDForcesNewSubnet() { Time: time.Now(), }, VcnID: "vcnid", - VirtualRouterID: "virtualrouterid", + VirtualRouterIP: "virtualrouterip", VirtualRouterMac: "virtualroutermac", } delRes := &baremetal.Subnet{} diff --git a/vendor/vendor.json b/vendor/vendor.json index 2a52c440c3b..738dd191488 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -318,7 +318,7 @@ "checksumSHA1": "poKBZQ8AFlXGB1cUjeIUptVtrmM=", "path": "github.com/MustWin/baremetal-sdk-go", "revision": "90056d2a697d91f59e355ed698b1150bb23e19b9", - "revisionTime": "2017-04-04T04:32:14Z" + "revisionTime": "2017-04-04T04:32:14Z", }, { "checksumSHA1": "Aqy8/FoAIidY/DeQ5oTYSZ4YFVc=", From 560898f7a08fbcbc8d3662518c7663b983b3ceb9 Mon Sep 17 00:00:00 2001 From: Joseph Anthony Pasquale Holsten Date: Fri, 7 Apr 2017 00:54:36 -0700 Subject: [PATCH 05/14] subnet: fix security_list_ids ordering `baremetal_core_subnet.security_list_ids` with multiple items causes destroy/add on every `terraform apply`, even with no changes. API state does not respect item ordering, so config and API state do not match (except when items happen to have exactly the same sorting as used by API state). Because local and remote state do not match, terraform will attempt to change remote state to match on every `apply`. Change `security_list_ids` from `TypeList` to `TypeSet`, so terraform only considers membership, not ordering. Fixes https://github.com/oracle/terraform-provider-baremetal/issues/44 --- core/subnet_resource.go | 9 +++--- core/subnet_resource_crud.go | 15 +++++++-- core_subnet_test.go | 60 +++++++++++++++++++----------------- 3 files changed, 49 insertions(+), 35 deletions(-) diff --git a/core/subnet_resource.go b/core/subnet_resource.go index 5dbe93dde1c..57d3a7fbfd2 100644 --- a/core/subnet_resource.go +++ b/core/subnet_resource.go @@ -3,9 +3,9 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func SubnetResource() *schema.Resource { @@ -41,9 +41,10 @@ func SubnetResource() *schema.Resource { ForceNew: true, }, "security_list_ids": { - Type: schema.TypeList, + Type: schema.TypeSet, Required: true, ForceNew: true, + Set: schema.HashString, Elem: &schema.Schema{ Type: schema.TypeString, }, @@ -54,11 +55,11 @@ func SubnetResource() *schema.Resource { Computed: true, }, "dhcp_options_id": { - Type: schema.TypeString, + Type: schema.TypeString, Optional: true, }, "dns_label": { - Type: schema.TypeString, + Type: schema.TypeString, Optional: true, }, "id": { diff --git a/core/subnet_resource_crud.go b/core/subnet_resource_crud.go index b34a847f048..aac0b4c801a 100644 --- a/core/subnet_resource_crud.go +++ b/core/subnet_resource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/hashicorp/terraform/helper/schema" "github.com/oracle/terraform-provider-baremetal/crud" ) @@ -57,7 +58,7 @@ func (s *SubnetResourceCrud) Create() (e error) { if rawSecurityListIDs, ok := s.D.GetOk("security_list_ids"); ok { securityListIDs := []string{} - for _, val := range rawSecurityListIDs.([]interface{}) { + for _, val := range rawSecurityListIDs.(*schema.Set).List() { securityListIDs = append(securityListIDs, val.(string)) } opts.SecurityListIDs = securityListIDs @@ -104,7 +105,7 @@ func (s *SubnetResourceCrud) SetData() { s.D.Set("dns_label", s.Resource.DNSLabel) s.D.Set("route_table_id", s.Resource.RouteTableID) s.D.Set("vcn_id", s.Resource.VcnID) - s.D.Set("security_list_ids", s.Resource.SecurityListIDs) + s.D.Set("security_list_ids", makeSetFromStrings(s.Resource.SecurityListIDs)) s.D.Set("state", s.Resource.State) s.D.Set("time_created", s.Resource.TimeCreated.String()) s.D.Set("virtual_router_ip", s.Resource.VirtualRouterIP) @@ -114,3 +115,13 @@ func (s *SubnetResourceCrud) SetData() { func (s *SubnetResourceCrud) Delete() (e error) { return s.Client.DeleteSubnet(s.D.Id(), nil) } + +// makeSetFromStrings encodes an []string into a +// *schema.Set in the appropriate structure for the schema +func makeSetFromStrings(ss []string) *schema.Set { + st := &schema.Set{F: schema.HashString} + for _, s := range ss { + st.Add(s) + } + return st +} diff --git a/core_subnet_test.go b/core_subnet_test.go index 9cf5750918a..cc74e5ea83c 100644 --- a/core_subnet_test.go +++ b/core_subnet_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) @@ -43,15 +43,15 @@ func (s *ResourceCoreSubnetTestSuite) SetupTest() { s.TimeCreated = baremetal.Time{Time: time.Now()} s.Config = ` - resource "baremetal_core_subnet" "t" { - availability_domain = "availabilitydomainid" - compartment_id = "compartmentid" - display_name = "display_name" - cidr_block = "10.10.10.0/24" - route_table_id = "routetableid" - vcn_id = "vcnid" - security_list_ids = ["slid1", "slid2"] - } +resource "baremetal_core_subnet" "t" { + availability_domain = "availabilitydomainid" + compartment_id = "compartmentid" + display_name = "display_name" + cidr_block = "10.10.10.0/24" + route_table_id = "routetableid" + vcn_id = "vcnid" + security_list_ids = ["slid1", "slid2"] +} ` s.Config += testProviderConfig @@ -65,8 +65,9 @@ func (s *ResourceCoreSubnetTestSuite) SetupTest() { ID: "id", RouteTableID: "routetableid", SecurityListIDs: []string{ - "slid1", + // Note: sorted by schema.HashString "slid2", + "slid1", }, State: baremetal.ResourceAvailable, TimeCreated: baremetal.Time{ @@ -122,14 +123,14 @@ func (s *ResourceCoreSubnetTestSuite) TestCreateResourceCoreSubnetWithoutDisplay s.Client.On("GetSubnet", "id").Return(s.DeletedRes, nil).Times(2) s.Config = ` - resource "baremetal_core_subnet" "t" { - availability_domain = "availabilitydomainid" - compartment_id = "compartmentid" - cidr_block = "10.10.10.0/24" - route_table_id = "routetableid" - vcn_id = "vcnid" - security_list_ids = ["slid1", "slid2"] - } +resource "baremetal_core_subnet" "t" { + availability_domain = "availabilitydomainid" + compartment_id = "compartmentid" + cidr_block = "10.10.10.0/24" + route_table_id = "routetableid" + vcn_id = "vcnid" + security_list_ids = ["slid1", "slid2"] +} ` s.Config += testProviderConfig @@ -162,15 +163,15 @@ func (s *ResourceCoreSubnetTestSuite) TestCreateResourceCoreSubnetWithoutDisplay func (s ResourceCoreSubnetTestSuite) TestUpdateCompartmentIDForcesNewSubnet() { config := ` - resource "baremetal_core_subnet" "t" { - availability_domain = "availabilitydomainid" - compartment_id = "new_compartmentid" - display_name = "display_name" - cidr_block = "10.10.10.0/24" - route_table_id = "routetableid" - vcn_id = "vcnid" - security_list_ids = ["slid1", "slid2"] - } +resource "baremetal_core_subnet" "t" { + availability_domain = "availabilitydomainid" + compartment_id = "new_compartmentid" + display_name = "display_name" + cidr_block = "10.10.10.0/24" + route_table_id = "routetableid" + vcn_id = "vcnid" + security_list_ids = ["slid1", "slid2"] +} ` config += testProviderConfig @@ -183,8 +184,9 @@ func (s ResourceCoreSubnetTestSuite) TestUpdateCompartmentIDForcesNewSubnet() { ID: "new_id", RouteTableID: "routetableid", SecurityListIDs: []string{ - "slid1", + // Note: sorted by schema.HashString "slid2", + "slid1", }, State: baremetal.ResourceAvailable, TimeCreated: baremetal.Time{ From 891db82058611ab9a2836115d224d252e4ec3c81 Mon Sep 17 00:00:00 2001 From: Joseph Anthony Pasquale Holsten Date: Fri, 7 Apr 2017 11:16:40 -0700 Subject: [PATCH 06/14] go fmt --- core_console_history_data_datasource_test.go | 2 +- core_console_history_test.go | 2 +- core_cpe_datasource_test.go | 2 +- core_cpe_test.go | 2 +- core_dhcp_options_datasource_test.go | 2 +- core_dhcp_options_test.go | 2 +- core_drg_attachment_datasource_test.go | 2 +- core_drg_attachment_test.go | 2 +- core_drg_datasource_test.go | 2 +- core_drg_test.go | 2 +- core_image_datasource_test.go | 2 +- core_image_test.go | 2 +- core_instance_datasource_test.go | 2 +- core_instance_test.go | 2 +- core_internet_gateway_datasource_test.go | 2 +- core_internet_gateway_test.go | 2 +- core_ipsec_datasource_config_test.go | 2 +- core_ipsec_datasource_status_test.go | 2 +- core_ipsec_datasource_test.go | 2 +- core_ipsec_test.go | 2 +- core_route_table_datasource_test.go | 2 +- core_route_table_test.go | 2 +- core_security_list_datasource_test.go | 2 +- core_security_list_test.go | 2 +- core_shape_datasource_test.go | 2 +- core_subnet_datasource_test.go | 2 +- core_virtual_network_datasource_test.go | 14 +- core_virtual_network_test.go | 10 +- core_vnic_attachment_datasource_test.go | 4 +- core_vnic_datasource_test.go | 2 +- core_volume_attachment_datasource_test.go | 2 +- core_volume_backup_datasource_test.go | 2 +- core_volume_datasource_test.go | 2 +- core_volume_test.go | 2 +- database_database_datasource_test.go | 2 +- database_databases_datasource_test.go | 2 +- database_db_home_datasource_test.go | 2 +- database_db_homes_datasource_test.go | 2 +- database_db_node_datasource_test.go | 2 +- database_db_nodes_datasource_test.go | 2 +- database_db_system_datasource_test.go | 2 +- database_db_system_shape_datasource_test.go | 2 +- database_db_system_test.go | 2 +- database_db_version_datasource_test.go | 2 +- ...se_supported_operations_datasource_test.go | 2 +- identity_api_key_datasource_test.go | 2 +- identity_api_key_test.go | 2 +- identity_compartment_datasource_test.go | 12 +- identity_compartment_test.go | 2 +- identity_group_datasource_test.go | 12 +- identity_group_test.go | 2 +- identity_policy_datasource_test.go | 16 +- identity_policy_test.go | 2 +- identity_swift_password_datasource_test.go | 39 +++-- identity_swift_password_test.go | 24 +-- identity_ui_password_test.go | 2 +- identity_user_datasource_test.go | 12 +- ...y_user_group_membership_datasource_test.go | 14 +- identity_user_test.go | 2 +- objectstorage_bucket_resource_test.go | 2 +- ...ctstorage_bucketsummary_datasource_test.go | 2 +- objectstorage_namespace_datasource_test.go | 2 +- objectstorage_object_datasource_test.go | 2 +- objectstorage_object_head_datasource_test.go | 2 +- objectstorage_object_resource_test.go | 2 +- provider.go | 142 +++++++++--------- 66 files changed, 203 insertions(+), 206 deletions(-) diff --git a/core_console_history_data_datasource_test.go b/core_console_history_data_datasource_test.go index 122aeff9413..c32d36842b3 100644 --- a/core_console_history_data_datasource_test.go +++ b/core_console_history_data_datasource_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "crypto/rand" diff --git a/core_console_history_test.go b/core_console_history_test.go index 2cd9905c03e..865cd13ca2b 100644 --- a/core_console_history_test.go +++ b/core_console_history_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_cpe_datasource_test.go b/core_cpe_datasource_test.go index c85361a9bba..abbad7f5cd7 100644 --- a/core_cpe_datasource_test.go +++ b/core_cpe_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_cpe_test.go b/core_cpe_test.go index 94e5fd8e5aa..0e376777200 100644 --- a/core_cpe_test.go +++ b/core_cpe_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_dhcp_options_datasource_test.go b/core_dhcp_options_datasource_test.go index 72111e893a8..b4a199dc614 100644 --- a/core_dhcp_options_datasource_test.go +++ b/core_dhcp_options_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_dhcp_options_test.go b/core_dhcp_options_test.go index 0f3dd5fcc22..22d4a3ca2e9 100644 --- a/core_dhcp_options_test.go +++ b/core_dhcp_options_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_drg_attachment_datasource_test.go b/core_drg_attachment_datasource_test.go index 25ed4c92568..b1e19657876 100644 --- a/core_drg_attachment_datasource_test.go +++ b/core_drg_attachment_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_drg_attachment_test.go b/core_drg_attachment_test.go index 503f1bae6f8..f923814271f 100644 --- a/core_drg_attachment_test.go +++ b/core_drg_attachment_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_drg_datasource_test.go b/core_drg_datasource_test.go index 4ae74533dd3..584792e453d 100644 --- a/core_drg_datasource_test.go +++ b/core_drg_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_drg_test.go b/core_drg_test.go index 1b3f5b53f80..652f53c0a00 100644 --- a/core_drg_test.go +++ b/core_drg_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_image_datasource_test.go b/core_image_datasource_test.go index 61edf5ca69f..51d5678fe07 100644 --- a/core_image_datasource_test.go +++ b/core_image_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_image_test.go b/core_image_test.go index 2d1357bfcfb..8f712277528 100644 --- a/core_image_test.go +++ b/core_image_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_instance_datasource_test.go b/core_instance_datasource_test.go index c8982275900..3d3b06930fd 100644 --- a/core_instance_datasource_test.go +++ b/core_instance_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_instance_test.go b/core_instance_test.go index d1e873f6fb1..14f27ce846f 100644 --- a/core_instance_test.go +++ b/core_instance_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/oracle/terraform-provider-baremetal/core" "github.com/oracle/terraform-provider-baremetal/crud" diff --git a/core_internet_gateway_datasource_test.go b/core_internet_gateway_datasource_test.go index b24059e55f3..4e5922437bc 100644 --- a/core_internet_gateway_datasource_test.go +++ b/core_internet_gateway_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_internet_gateway_test.go b/core_internet_gateway_test.go index 20953e11e11..b5221bc7d78 100644 --- a/core_internet_gateway_test.go +++ b/core_internet_gateway_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" // "errors" diff --git a/core_ipsec_datasource_config_test.go b/core_ipsec_datasource_config_test.go index 6cf4f73f96b..337aa313f42 100644 --- a/core_ipsec_datasource_config_test.go +++ b/core_ipsec_datasource_config_test.go @@ -7,10 +7,10 @@ import ( "time" baremetal "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_ipsec_datasource_status_test.go b/core_ipsec_datasource_status_test.go index c1fee8d3ec3..b7ef7a7602b 100644 --- a/core_ipsec_datasource_status_test.go +++ b/core_ipsec_datasource_status_test.go @@ -7,10 +7,10 @@ import ( "time" baremetal "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_ipsec_datasource_test.go b/core_ipsec_datasource_test.go index c404a3da6ce..7b507136b3a 100644 --- a/core_ipsec_datasource_test.go +++ b/core_ipsec_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_ipsec_test.go b/core_ipsec_test.go index 401d2e00cbe..8467c0437a8 100644 --- a/core_ipsec_test.go +++ b/core_ipsec_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_route_table_datasource_test.go b/core_route_table_datasource_test.go index 043c41a6b72..2233348ddee 100644 --- a/core_route_table_datasource_test.go +++ b/core_route_table_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_route_table_test.go b/core_route_table_test.go index 0232a70f0db..be571df1543 100644 --- a/core_route_table_test.go +++ b/core_route_table_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_security_list_datasource_test.go b/core_security_list_datasource_test.go index f9362a1297e..7dacea08eb5 100644 --- a/core_security_list_datasource_test.go +++ b/core_security_list_datasource_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_security_list_test.go b/core_security_list_test.go index f9cd49fb594..1191d29930c 100644 --- a/core_security_list_test.go +++ b/core_security_list_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/oracle/terraform-provider-baremetal/crud" "github.com/stretchr/testify/suite" diff --git a/core_shape_datasource_test.go b/core_shape_datasource_test.go index b2c3d1c6f8e..550b20ac8d8 100644 --- a/core_shape_datasource_test.go +++ b/core_shape_datasource_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_subnet_datasource_test.go b/core_subnet_datasource_test.go index a685de2bea4..45005fdab33 100644 --- a/core_subnet_datasource_test.go +++ b/core_subnet_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_virtual_network_datasource_test.go b/core_virtual_network_datasource_test.go index 421e3edb449..59a1092f84a 100644 --- a/core_virtual_network_datasource_test.go +++ b/core_virtual_network_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) @@ -59,7 +59,7 @@ func (s *ResourceCoreVirtualNetworksTestSuite) TestReadVirtualNetworks() { { CidrBlock: "cidr_block", CompartmentID: "compartment_id", - DefaultRouteTableID: "default_route_table_id", + DefaultRouteTableID: "default_route_table_id", DefaultSecurityListID: "default_security_list_id", DisplayName: "display_name", ID: "id1", @@ -69,7 +69,7 @@ func (s *ResourceCoreVirtualNetworksTestSuite) TestReadVirtualNetworks() { { CidrBlock: "cidr_block", CompartmentID: "compartment_id", - DefaultRouteTableID: "default_route_table_id", + DefaultRouteTableID: "default_route_table_id", DefaultSecurityListID: "default_security_list_id", DisplayName: "display_name", ID: "id2", @@ -115,7 +115,7 @@ func (s *ResourceCoreVirtualNetworksTestSuite) TestReadVirtualNetworksWithPaging { CidrBlock: "cidr_block", CompartmentID: "compartment_id", - DefaultRouteTableID: "default_route_table_id", + DefaultRouteTableID: "default_route_table_id", DefaultSecurityListID: "default_security_list_id", DisplayName: "display_name", ID: "id1", @@ -125,7 +125,7 @@ func (s *ResourceCoreVirtualNetworksTestSuite) TestReadVirtualNetworksWithPaging { CidrBlock: "cidr_block", CompartmentID: "compartment_id", - DefaultRouteTableID: "default_route_table_id", + DefaultRouteTableID: "default_route_table_id", DefaultSecurityListID: "default_security_list_id", DisplayName: "display_name", ID: "id2", @@ -154,7 +154,7 @@ func (s *ResourceCoreVirtualNetworksTestSuite) TestReadVirtualNetworksWithPaging { CidrBlock: "cidr_block", CompartmentID: "compartment_id", - DefaultRouteTableID: "default_route_table_id", + DefaultRouteTableID: "default_route_table_id", DefaultSecurityListID: "default_security_list_id", DisplayName: "display_name", ID: "id3", @@ -164,7 +164,7 @@ func (s *ResourceCoreVirtualNetworksTestSuite) TestReadVirtualNetworksWithPaging { CidrBlock: "cidr_block", CompartmentID: "compartment_id", - DefaultRouteTableID: "default_route_table_id", + DefaultRouteTableID: "default_route_table_id", DefaultSecurityListID: "default_security_list_id", DisplayName: "display_name", ID: "id4", diff --git a/core_virtual_network_test.go b/core_virtual_network_test.go index 202994fdcb4..57e36178153 100644 --- a/core_virtual_network_test.go +++ b/core_virtual_network_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "errors" @@ -59,7 +59,7 @@ func (s *ResourceCoreVirtualNetworkTestSuite) SetupTest() { s.Res = &baremetal.VirtualNetwork{ CidrBlock: "cidr_block", CompartmentID: "compartment_id", - DefaultRouteTableID: "default_route_table_id", + DefaultRouteTableID: "default_route_table_id", DefaultSecurityListID: "default_security_list_id", DisplayName: "display_name", ID: "id", @@ -72,7 +72,7 @@ func (s *ResourceCoreVirtualNetworkTestSuite) SetupTest() { s.DeletingRes = &baremetal.VirtualNetwork{ CidrBlock: "cidr_block", CompartmentID: "compartment_id", - DefaultRouteTableID: "default_route_table_id", + DefaultRouteTableID: "default_route_table_id", DefaultSecurityListID: "default_security_list_id", DisplayName: "display_name", ID: "id", @@ -83,7 +83,7 @@ func (s *ResourceCoreVirtualNetworkTestSuite) SetupTest() { s.DeletedRes = &baremetal.VirtualNetwork{ CidrBlock: "cidr_block", CompartmentID: "compartment_id", - DefaultRouteTableID: "default_route_table_id", + DefaultRouteTableID: "default_route_table_id", DefaultSecurityListID: "default_security_list_id", DisplayName: "display_name", ID: "id", @@ -199,7 +199,7 @@ func (s ResourceCoreVirtualNetworkTestSuite) TestUpdateCidrBlockForcesNewVirtual res := &baremetal.VirtualNetwork{ CidrBlock: "new_cidr_block", CompartmentID: "compartment_id", - DefaultRouteTableID: "default_route_table_id", + DefaultRouteTableID: "default_route_table_id", DefaultSecurityListID: "default_security_list_id", DisplayName: "display_name", ID: "new_id", diff --git a/core_vnic_attachment_datasource_test.go b/core_vnic_attachment_datasource_test.go index 0199c681c7d..2f57d8fbdb6 100644 --- a/core_vnic_attachment_datasource_test.go +++ b/core_vnic_attachment_datasource_test.go @@ -7,11 +7,11 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" - "github.com/oracle/terraform-provider-baremetal/crud" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" + "github.com/oracle/terraform-provider-baremetal/crud" "github.com/stretchr/testify/suite" ) diff --git a/core_vnic_datasource_test.go b/core_vnic_datasource_test.go index 5fc52e31584..4f8f16dace6 100644 --- a/core_vnic_datasource_test.go +++ b/core_vnic_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_volume_attachment_datasource_test.go b/core_volume_attachment_datasource_test.go index 09b3a1ca042..8f1d8e4e69e 100644 --- a/core_volume_attachment_datasource_test.go +++ b/core_volume_attachment_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_volume_backup_datasource_test.go b/core_volume_backup_datasource_test.go index b7ebe78c40c..3c25d9c6294 100644 --- a/core_volume_backup_datasource_test.go +++ b/core_volume_backup_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_volume_datasource_test.go b/core_volume_datasource_test.go index 1588bc1d1da..019b0f0b182 100644 --- a/core_volume_datasource_test.go +++ b/core_volume_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/core_volume_test.go b/core_volume_test.go index 5be18b9a4e4..5c5c9476213 100644 --- a/core_volume_test.go +++ b/core_volume_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" //"strconv" diff --git a/database_database_datasource_test.go b/database_database_datasource_test.go index b2c7ceea2ac..6b45f80ce40 100644 --- a/database_database_datasource_test.go +++ b/database_database_datasource_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/database_databases_datasource_test.go b/database_databases_datasource_test.go index 24f141c94a5..64cb767ba30 100644 --- a/database_databases_datasource_test.go +++ b/database_databases_datasource_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/database_db_home_datasource_test.go b/database_db_home_datasource_test.go index 1090080d61b..dc3bb3c1b0f 100644 --- a/database_db_home_datasource_test.go +++ b/database_db_home_datasource_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/database_db_homes_datasource_test.go b/database_db_homes_datasource_test.go index b3e8e0c4e0f..c59046be972 100644 --- a/database_db_homes_datasource_test.go +++ b/database_db_homes_datasource_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/database_db_node_datasource_test.go b/database_db_node_datasource_test.go index b1079b97543..56b258b2982 100644 --- a/database_db_node_datasource_test.go +++ b/database_db_node_datasource_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/database_db_nodes_datasource_test.go b/database_db_nodes_datasource_test.go index 70fee63086d..b583ef46a46 100644 --- a/database_db_nodes_datasource_test.go +++ b/database_db_nodes_datasource_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/database_db_system_datasource_test.go b/database_db_system_datasource_test.go index e42825089b4..baac843eab2 100644 --- a/database_db_system_datasource_test.go +++ b/database_db_system_datasource_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/database_db_system_shape_datasource_test.go b/database_db_system_shape_datasource_test.go index 381775d6879..ab5d85a671f 100644 --- a/database_db_system_shape_datasource_test.go +++ b/database_db_system_shape_datasource_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/database_db_system_test.go b/database_db_system_test.go index bcd9ef8f877..ab0ae461fab 100644 --- a/database_db_system_test.go +++ b/database_db_system_test.go @@ -10,10 +10,10 @@ import ( "text/template" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/database_db_version_datasource_test.go b/database_db_version_datasource_test.go index b47d605471b..be227e877ba 100644 --- a/database_db_version_datasource_test.go +++ b/database_db_version_datasource_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/database_supported_operations_datasource_test.go b/database_supported_operations_datasource_test.go index 75aed79d89b..eb68a814c1d 100644 --- a/database_supported_operations_datasource_test.go +++ b/database_supported_operations_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/identity_api_key_datasource_test.go b/identity_api_key_datasource_test.go index 81ea6d77d3a..5470e2dbab2 100644 --- a/identity_api_key_datasource_test.go +++ b/identity_api_key_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/identity_api_key_test.go b/identity_api_key_test.go index b0d73761412..59c99f3b9a9 100644 --- a/identity_api_key_test.go +++ b/identity_api_key_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/identity_compartment_datasource_test.go b/identity_compartment_datasource_test.go index 5b6aef87455..9d9d57ba9c6 100644 --- a/identity_compartment_datasource_test.go +++ b/identity_compartment_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) @@ -43,12 +43,12 @@ func (s *ResourceIdentityCompartmentsTestSuite) SetupTest() { s.ResourceName = "data.baremetal_identity_compartments.t" b1 := baremetal.Compartment{ - ID: "id", - Name: "compartmentname", + ID: "id", + Name: "compartmentname", CompartmentID: "compartment", - Description: "blah", - State: baremetal.ResourceActive, - TimeCreated: time.Now(), + Description: "blah", + State: baremetal.ResourceActive, + TimeCreated: time.Now(), } b2 := b1 diff --git a/identity_compartment_test.go b/identity_compartment_test.go index faf4a37c5df..c26b93ef0c3 100644 --- a/identity_compartment_test.go +++ b/identity_compartment_test.go @@ -9,10 +9,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/identity_group_datasource_test.go b/identity_group_datasource_test.go index 47ee5de6c4e..82fb7f1b9e2 100644 --- a/identity_group_datasource_test.go +++ b/identity_group_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) @@ -43,12 +43,12 @@ func (s *ResourceIdentityGroupsTestSuite) SetupTest() { s.ResourceName = "data.baremetal_identity_groups.t" b1 := baremetal.Group{ - ID: "id", - Name: "groupname", + ID: "id", + Name: "groupname", CompartmentID: "compartment", - Description: "blah", - State: baremetal.ResourceActive, - TimeCreated: time.Now(), + Description: "blah", + State: baremetal.ResourceActive, + TimeCreated: time.Now(), } b2 := b1 diff --git a/identity_group_test.go b/identity_group_test.go index 66205138f39..17e79758a3f 100644 --- a/identity_group_test.go +++ b/identity_group_test.go @@ -9,10 +9,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/identity_policy_datasource_test.go b/identity_policy_datasource_test.go index 3aa03fc257e..45195b06843 100644 --- a/identity_policy_datasource_test.go +++ b/identity_policy_datasource_test.go @@ -7,10 +7,10 @@ import ( "testing" "time" - "github.com/stretchr/testify/suite" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/stretchr/testify/suite" "github.com/MustWin/baremetal-sdk-go" "github.com/oracle/terraform-provider-baremetal/client/mocks" @@ -24,13 +24,13 @@ var testPoliciesConfig = ` type ResourceIdentityPoliciesTestSuite struct { suite.Suite - Client *mocks.BareMetalClient - Provider terraform.ResourceProvider - Providers map[string]terraform.ResourceProvider - TimeCreated time.Time - Config string - PoliciesName string - Policies baremetal.ListPolicies + Client *mocks.BareMetalClient + Provider terraform.ResourceProvider + Providers map[string]terraform.ResourceProvider + TimeCreated time.Time + Config string + PoliciesName string + Policies baremetal.ListPolicies } func (s *ResourceIdentityPoliciesTestSuite) SetupTest() { diff --git a/identity_policy_test.go b/identity_policy_test.go index 1e4bb1ad69a..50718b2d1d4 100644 --- a/identity_policy_test.go +++ b/identity_policy_test.go @@ -10,10 +10,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/identity_swift_password_datasource_test.go b/identity_swift_password_datasource_test.go index b4b7b35fa75..ed87f704a63 100644 --- a/identity_swift_password_datasource_test.go +++ b/identity_swift_password_datasource_test.go @@ -4,9 +4,9 @@ package main import ( "fmt" + "strconv" "testing" "time" - "strconv" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" @@ -15,7 +15,6 @@ import ( "github.com/MustWin/baremetal-sdk-go" "github.com/oracle/terraform-provider-baremetal/client/mocks" - ) var testPasswordsConfig = ` @@ -26,13 +25,13 @@ var testPasswordsConfig = ` type ResourceIdentitySwiftPasswordsTestSuite struct { suite.Suite - Client *mocks.BareMetalClient - Provider terraform.ResourceProvider - Providers map[string]terraform.ResourceProvider - TimeCreated time.Time - Config string + Client *mocks.BareMetalClient + Provider terraform.ResourceProvider + Providers map[string]terraform.ResourceProvider + TimeCreated time.Time + Config string PasswordsName string - PasswordList baremetal.ListSwiftPasswords + PasswordList baremetal.ListSwiftPasswords } func (s *ResourceIdentitySwiftPasswordsTestSuite) SetupTest() { @@ -50,22 +49,22 @@ func (s *ResourceIdentitySwiftPasswordsTestSuite) SetupTest() { s.PasswordList = baremetal.ListSwiftPasswords{ SwiftPasswords: []baremetal.SwiftPassword{ { - Password: "pass", - ID: "1", - UserID: "userid", - Description: "desc", - State: "available", + Password: "pass", + ID: "1", + UserID: "userid", + Description: "desc", + State: "available", InactiveStatus: 0, - TimeCreated: time.Now(), + TimeCreated: time.Now(), }, { - Password: "pass", - ID: "2", - UserID: "userid", - Description: "desc", - State: "available", + Password: "pass", + ID: "2", + UserID: "userid", + Description: "desc", + State: "available", InactiveStatus: 0, - TimeCreated: time.Now(), + TimeCreated: time.Now(), }, }, } diff --git a/identity_swift_password_test.go b/identity_swift_password_test.go index 23f711dac1e..bc24fbde89f 100644 --- a/identity_swift_password_test.go +++ b/identity_swift_password_test.go @@ -52,10 +52,10 @@ func (s *ResourceIdentitySwiftPasswordTestSuite) SetupTest() { s.ResourceName = "baremetal_identity_swift_password.t" s.Res = &baremetal.SwiftPassword{ - ID: "id", + ID: "id", Password: "password", TimeCreated: s.TimeCreated, - State: baremetal.ResourceActive, + State: baremetal.ResourceActive, UserID: "user_id", Description: description, } @@ -66,11 +66,11 @@ func (s *ResourceIdentitySwiftPasswordTestSuite) SetupTest() { Return(s.Res, nil).Once() s.Client.On("ListSwiftPasswords", "user_id"). Return( - &baremetal.ListSwiftPasswords{ - SwiftPasswords: []baremetal.SwiftPassword{ - *s.Res, - }, - }, nil).Twice() + &baremetal.ListSwiftPasswords{ + SwiftPasswords: []baremetal.SwiftPassword{ + *s.Res, + }, + }, nil).Twice() s.Client.On("DeleteSwiftPassword", "id", "user_id", (*baremetal.IfMatchOptions)(nil)).Return(nil).Once() } @@ -105,11 +105,11 @@ func (s ResourceIdentitySwiftPasswordTestSuite) TestUpdateDescriptionUpdatesSwif Return(res, nil) s.Client.On("ListSwiftPasswords", "user_id"). Return( - &baremetal.ListSwiftPasswords{ - SwiftPasswords: []baremetal.SwiftPassword{ - *res, - }, - }, nil).Twice() + &baremetal.ListSwiftPasswords{ + SwiftPasswords: []baremetal.SwiftPassword{ + *res, + }, + }, nil).Twice() resource.UnitTest(s.T(), resource.TestCase{ Providers: s.Providers, diff --git a/identity_ui_password_test.go b/identity_ui_password_test.go index 520ef4d5b87..23332af442a 100644 --- a/identity_ui_password_test.go +++ b/identity_ui_password_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/identity_user_datasource_test.go b/identity_user_datasource_test.go index 619d892ff4a..72bb8f0cd9a 100644 --- a/identity_user_datasource_test.go +++ b/identity_user_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) @@ -43,12 +43,12 @@ func (s *ResourceIdentityUsersTestSuite) SetupTest() { s.ResourceName = "data.baremetal_identity_users.t" b1 := baremetal.User{ - ID: "id", - Name: "username", + ID: "id", + Name: "username", CompartmentID: "compartment", - Description: "blah", - State: baremetal.ResourceActive, - TimeCreated: time.Now(), + Description: "blah", + State: baremetal.ResourceActive, + TimeCreated: time.Now(), } b2 := b1 diff --git a/identity_user_group_membership_datasource_test.go b/identity_user_group_membership_datasource_test.go index 754daf54f4a..9c885b11dfc 100644 --- a/identity_user_group_membership_datasource_test.go +++ b/identity_user_group_membership_datasource_test.go @@ -3,9 +3,9 @@ package main import ( + "fmt" "testing" "time" - "fmt" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" @@ -14,7 +14,6 @@ import ( "github.com/MustWin/baremetal-sdk-go" "github.com/oracle/terraform-provider-baremetal/client/mocks" - ) type ResourceIdentityUserGroupMembershipsTestSuite struct { @@ -37,7 +36,6 @@ func (s *ResourceIdentityUserGroupMembershipsTestSuite) SetupTest() { "baremetal": s.Provider, } - s.Config = ` resource "baremetal_identity_user" "u" { name = "user_name" @@ -73,11 +71,11 @@ func (s *ResourceIdentityUserGroupMembershipsTestSuite) SetupTest() { } m1 := &baremetal.UserGroupMembership{ CompartmentID: "cid", - GroupID: g1.ID, - ID: "user_group_id", - State: baremetal.ResourceActive, - TimeCreated: time.Now(), - UserID: u1.ID, + GroupID: g1.ID, + ID: "user_group_id", + State: baremetal.ResourceActive, + TimeCreated: time.Now(), + UserID: u1.ID, } s.List = &baremetal.ListUserGroupMemberships{ diff --git a/identity_user_test.go b/identity_user_test.go index deeca0aeb8a..d43d0518364 100644 --- a/identity_user_test.go +++ b/identity_user_test.go @@ -9,10 +9,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/objectstorage_bucket_resource_test.go b/objectstorage_bucket_resource_test.go index ea06dd90555..a411cc20c3f 100644 --- a/objectstorage_bucket_resource_test.go +++ b/objectstorage_bucket_resource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/objectstorage_bucketsummary_datasource_test.go b/objectstorage_bucketsummary_datasource_test.go index 2f679cb181b..6c3c0964b35 100644 --- a/objectstorage_bucketsummary_datasource_test.go +++ b/objectstorage_bucketsummary_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/objectstorage_namespace_datasource_test.go b/objectstorage_namespace_datasource_test.go index c565f949e92..fc34bfca83f 100644 --- a/objectstorage_namespace_datasource_test.go +++ b/objectstorage_namespace_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/objectstorage_object_datasource_test.go b/objectstorage_object_datasource_test.go index 54023b87495..21b665ba32c 100644 --- a/objectstorage_object_datasource_test.go +++ b/objectstorage_object_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/objectstorage_object_head_datasource_test.go b/objectstorage_object_head_datasource_test.go index 2cc692371f8..4e7836d64f5 100644 --- a/objectstorage_object_head_datasource_test.go +++ b/objectstorage_object_head_datasource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/objectstorage_object_resource_test.go b/objectstorage_object_resource_test.go index dd93fad05fe..5f386b015d4 100644 --- a/objectstorage_object_resource_test.go +++ b/objectstorage_object_resource_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" ) diff --git a/provider.go b/provider.go index 6ee39ebaffe..288351ffb4f 100644 --- a/provider.go +++ b/provider.go @@ -8,12 +8,12 @@ import ( "net/http" "github.com/MustWin/baremetal-sdk-go" + "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/terraform" "github.com/oracle/terraform-provider-baremetal/core" "github.com/oracle/terraform-provider-baremetal/database" "github.com/oracle/terraform-provider-baremetal/identity" "github.com/oracle/terraform-provider-baremetal/objectstorage" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/terraform" "os" "strconv" ) @@ -30,7 +30,7 @@ func init() { "private_key_path": "(Optional) The path to the user's PEM formatted private key.\n" + "A private_key or a private_key_path must be provided.", "private_key_password": "(Optional) The password used to secure the private key.", - "timeout_minutes": "(Optional) The minimum API timeout for requests", + "timeout_minutes": "(Optional) The minimum API timeout for requests", } } @@ -95,81 +95,81 @@ func schemaMap() map[string]*schema.Schema { func dataSourcesMap() map[string]*schema.Resource { return map[string]*schema.Resource{ - "baremetal_core_console_history_data": core.ConsoleHistoryDataDatasource(), - "baremetal_core_cpes": core.CpeDatasource(), - "baremetal_core_dhcp_options": core.DHCPOptionsDatasource(), - "baremetal_core_drg_attachments": core.DrgAttachmentDatasource(), - "baremetal_core_drgs": core.DrgDatasource(), - "baremetal_core_images": core.ImageDatasource(), - "baremetal_core_instances": core.InstanceDatasource(), - "baremetal_core_internet_gateways": core.InternetGatewayDatasource(), - "baremetal_core_ipsec_config": core.IPSecConnectionConfigDatasource(), - "baremetal_core_ipsec_connections": core.IPSecConnectionsDatasource(), - "baremetal_core_ipsec_status": core.IPSecConnectionStatusDatasource(), - "baremetal_core_route_tables": core.RouteTableDatasource(), - "baremetal_core_security_lists": core.SecurityListDatasource(), - "baremetal_core_shape": core.ShapeDatasource(), - "baremetal_core_subnets": core.SubnetDatasource(), - "baremetal_core_virtual_networks": core.VirtualNetworkDatasource(), - "baremetal_core_vnic_attachments": core.DatasourceCoreVnicAttachments(), - "baremetal_core_vnic": core.VnicDatasource(), - "baremetal_core_volume_attachments": core.VolumeAttachmentDatasource(), - "baremetal_core_volume_backups": core.VolumeBackupDatasource(), - "baremetal_core_volumes": core.VolumeDatasource(), - "baremetal_database_database": database.DatabaseDatasource(), - "baremetal_database_databases": database.DatabasesDatasource(), - "baremetal_database_db_home": database.DBHomeDatasource(), - "baremetal_database_db_homes": database.DBHomesDatasource(), - "baremetal_database_db_node": database.DBNodeDatasource(), - "baremetal_database_db_nodes": database.DBNodesDatasource(), - "baremetal_database_db_systems": database.DBSystemDatasource(), - "baremetal_database_db_system_shapes": database.DBSystemShapeDatasource(), - "baremetal_database_db_versions": database.DBVersionDatasource(), - "baremetal_database_supported_operations": database.SupportedOperationDatasource(), - "baremetal_identity_api_keys": identity.APIKeyDatasource(), - "baremetal_identity_availability_domains": identity.AvailabilityDomainDatasource(), - "baremetal_identity_compartments": identity.CompartmentDatasource(), - "baremetal_identity_groups": identity.GroupDatasource(), - "baremetal_identity_policies": identity.PolicyDatasource(), - "baremetal_identity_users": identity.UserDatasource(), + "baremetal_core_console_history_data": core.ConsoleHistoryDataDatasource(), + "baremetal_core_cpes": core.CpeDatasource(), + "baremetal_core_dhcp_options": core.DHCPOptionsDatasource(), + "baremetal_core_drg_attachments": core.DrgAttachmentDatasource(), + "baremetal_core_drgs": core.DrgDatasource(), + "baremetal_core_images": core.ImageDatasource(), + "baremetal_core_instances": core.InstanceDatasource(), + "baremetal_core_internet_gateways": core.InternetGatewayDatasource(), + "baremetal_core_ipsec_config": core.IPSecConnectionConfigDatasource(), + "baremetal_core_ipsec_connections": core.IPSecConnectionsDatasource(), + "baremetal_core_ipsec_status": core.IPSecConnectionStatusDatasource(), + "baremetal_core_route_tables": core.RouteTableDatasource(), + "baremetal_core_security_lists": core.SecurityListDatasource(), + "baremetal_core_shape": core.ShapeDatasource(), + "baremetal_core_subnets": core.SubnetDatasource(), + "baremetal_core_virtual_networks": core.VirtualNetworkDatasource(), + "baremetal_core_vnic_attachments": core.DatasourceCoreVnicAttachments(), + "baremetal_core_vnic": core.VnicDatasource(), + "baremetal_core_volume_attachments": core.VolumeAttachmentDatasource(), + "baremetal_core_volume_backups": core.VolumeBackupDatasource(), + "baremetal_core_volumes": core.VolumeDatasource(), + "baremetal_database_database": database.DatabaseDatasource(), + "baremetal_database_databases": database.DatabasesDatasource(), + "baremetal_database_db_home": database.DBHomeDatasource(), + "baremetal_database_db_homes": database.DBHomesDatasource(), + "baremetal_database_db_node": database.DBNodeDatasource(), + "baremetal_database_db_nodes": database.DBNodesDatasource(), + "baremetal_database_db_systems": database.DBSystemDatasource(), + "baremetal_database_db_system_shapes": database.DBSystemShapeDatasource(), + "baremetal_database_db_versions": database.DBVersionDatasource(), + "baremetal_database_supported_operations": database.SupportedOperationDatasource(), + "baremetal_identity_api_keys": identity.APIKeyDatasource(), + "baremetal_identity_availability_domains": identity.AvailabilityDomainDatasource(), + "baremetal_identity_compartments": identity.CompartmentDatasource(), + "baremetal_identity_groups": identity.GroupDatasource(), + "baremetal_identity_policies": identity.PolicyDatasource(), + "baremetal_identity_users": identity.UserDatasource(), "baremetal_identity_user_group_memberships": identity.UserGroupMembershipDatasource(), - "baremetal_identity_swift_passwords": identity.SwiftPasswordDatasource(), - "baremetal_objectstorage_bucket_summaries": objectstorage.BucketSummaryDatasource(), - "baremetal_objectstorage_object_head": objectstorage.ObjectHeadDatasource(), - "baremetal_objectstorage_objects": objectstorage.ObjectDatasource(), - "baremetal_objectstorage_namespace": objectstorage.NamespaceDatasource(), + "baremetal_identity_swift_passwords": identity.SwiftPasswordDatasource(), + "baremetal_objectstorage_bucket_summaries": objectstorage.BucketSummaryDatasource(), + "baremetal_objectstorage_object_head": objectstorage.ObjectHeadDatasource(), + "baremetal_objectstorage_objects": objectstorage.ObjectDatasource(), + "baremetal_objectstorage_namespace": objectstorage.NamespaceDatasource(), } } func resourcesMap() map[string]*schema.Resource { return map[string]*schema.Resource{ - "baremetal_core_console_history": core.ConsoleHistoryResource(), - "baremetal_core_cpe": core.CpeResource(), - "baremetal_core_dhcp_options": core.DHCPOptionsResource(), - "baremetal_core_drg_attachment": core.DrgAttachmentResource(), - "baremetal_core_drg": core.DrgResource(), - "baremetal_core_image": core.ImageResource(), - "baremetal_core_instance": core.InstanceResource(), - "baremetal_core_internet_gateway": core.InternetGatewayResource(), - "baremetal_core_ipsec": core.IPSecConnectionResource(), - "baremetal_core_route_table": core.RouteTableResource(), - "baremetal_core_security_list": core.SecurityListResource(), - "baremetal_core_subnet": core.SubnetResource(), - "baremetal_core_virtual_network": core.VirtualNetworkResource(), - "baremetal_core_volume_attachment": core.VolumeAttachmentResource(), - "baremetal_core_volume_backup": core.VolumeBackupResource(), - "baremetal_core_volume": core.VolumeResource(), - "baremetal_database_db_system": database.DBSystemResource(), - "baremetal_identity_api_key": identity.APIKeyResource(), - "baremetal_identity_compartment": identity.CompartmentResource(), - "baremetal_identity_group": identity.GroupResource(), - "baremetal_identity_policy": identity.PolicyResource(), - "baremetal_identity_ui_password": identity.UIPasswordResource(), - "baremetal_identity_user": identity.UserResource(), + "baremetal_core_console_history": core.ConsoleHistoryResource(), + "baremetal_core_cpe": core.CpeResource(), + "baremetal_core_dhcp_options": core.DHCPOptionsResource(), + "baremetal_core_drg_attachment": core.DrgAttachmentResource(), + "baremetal_core_drg": core.DrgResource(), + "baremetal_core_image": core.ImageResource(), + "baremetal_core_instance": core.InstanceResource(), + "baremetal_core_internet_gateway": core.InternetGatewayResource(), + "baremetal_core_ipsec": core.IPSecConnectionResource(), + "baremetal_core_route_table": core.RouteTableResource(), + "baremetal_core_security_list": core.SecurityListResource(), + "baremetal_core_subnet": core.SubnetResource(), + "baremetal_core_virtual_network": core.VirtualNetworkResource(), + "baremetal_core_volume_attachment": core.VolumeAttachmentResource(), + "baremetal_core_volume_backup": core.VolumeBackupResource(), + "baremetal_core_volume": core.VolumeResource(), + "baremetal_database_db_system": database.DBSystemResource(), + "baremetal_identity_api_key": identity.APIKeyResource(), + "baremetal_identity_compartment": identity.CompartmentResource(), + "baremetal_identity_group": identity.GroupResource(), + "baremetal_identity_policy": identity.PolicyResource(), + "baremetal_identity_ui_password": identity.UIPasswordResource(), + "baremetal_identity_user": identity.UserResource(), "baremetal_identity_user_group_membership": identity.UserGroupMembershipResource(), - "baremetal_identity_swift_password": identity.SwiftPasswordResource(), - "baremetal_objectstorage_bucket": objectstorage.BucketResource(), - "baremetal_objectstorage_object": objectstorage.ObjectResource(), + "baremetal_identity_swift_password": identity.SwiftPasswordResource(), + "baremetal_objectstorage_bucket": objectstorage.BucketResource(), + "baremetal_objectstorage_object": objectstorage.ObjectResource(), } } From f95b9f641626eaafef98305d19415337a8feb39b Mon Sep 17 00:00:00 2001 From: Joseph Anthony Pasquale Holsten Date: Fri, 7 Apr 2017 11:39:12 -0700 Subject: [PATCH 07/14] goimports --- client_test.go | 3 ++- core/console_history_data_datasource.go | 3 ++- core/console_history_resource.go | 3 ++- core/console_history_resource_crud.go | 1 + core/cpe_datasource.go | 3 ++- core/cpe_datasource_crud.go | 1 + core/cpe_resource.go | 3 ++- core/cpe_resource_crud.go | 1 + core/dhcp_options_datasource.go | 3 ++- core/dhcp_options_datasource_crud.go | 1 + core/dhcp_options_resource.go | 3 ++- core/dhcp_options_resource_crud.go | 1 + core/drg_attachment_datasource.go | 3 ++- core/drg_attachment_datasource_crud.go | 1 + core/drg_attachment_resource.go | 3 ++- core/drg_attachment_resource_crud.go | 1 + core/drg_datasource.go | 3 ++- core/drg_datasource_crud.go | 1 + core/drg_resource.go | 3 ++- core/drg_resource_crud.go | 1 + core/image_datasource.go | 3 ++- core/image_datasource_crud.go | 1 + core/image_resource.go | 3 ++- core/instance_datasource.go | 3 ++- core/instance_resource.go | 3 ++- core/instance_resource_crud.go | 1 + core/internet_gateway_datasource.go | 3 ++- core/internet_gateway_datasource_crud.go | 1 + core/internet_gateway_resource.go | 3 ++- core/ipsec_connection_config_datasource.go | 3 ++- core/ipsec_connection_resource.go | 3 ++- core/ipsec_connection_status_datasource.go | 3 ++- core/ipsec_connections_datasource.go | 3 ++- core/route_table_datasource.go | 3 ++- core/route_table_resource.go | 3 ++- core/security_list_datasource.go | 3 ++- core/security_list_resource.go | 7 ++++--- core/security_list_resource_crud.go | 1 + core/shape_datasource.go | 3 ++- core/subnet_datasource.go | 3 ++- core/subnet_resource.go | 1 + core/subnet_resource_crud.go | 1 + core/virtual_network_datasource.go | 3 ++- core/virtual_network_datasource_crud.go | 2 +- core/virtual_network_resource.go | 3 ++- core/virtual_network_resource_crud.go | 1 + core/vnic_attachment_datasource.go | 3 ++- core/vnic_datasource.go | 3 ++- core/volume_attachment_datasource.go | 3 ++- core/volume_backup_datasource.go | 3 ++- core/volume_backup_resource.go | 3 ++- core/volume_datasource.go | 3 ++- core/volume_resource.go | 3 ++- core_console_history_data_datasource_test.go | 1 + core_console_history_test.go | 1 + core_cpe_datasource_test.go | 1 + core_cpe_test.go | 1 + core_dhcp_options_datasource_test.go | 1 + core_dhcp_options_test.go | 1 + core_drg_attachment_datasource_test.go | 1 + core_drg_attachment_test.go | 1 + core_drg_datasource_test.go | 1 + core_drg_test.go | 1 + core_image_datasource_test.go | 1 + core_image_test.go | 1 + core_instance_datasource_test.go | 1 + core_instance_test.go | 4 +++- core_internet_gateway_datasource_test.go | 1 + core_internet_gateway_test.go | 1 + core_ipsec_datasource_config_test.go | 1 + core_ipsec_datasource_status_test.go | 1 + core_ipsec_datasource_test.go | 1 + core_ipsec_test.go | 1 + core_route_table_datasource_test.go | 1 + core_route_table_test.go | 1 + core_security_list_datasource_test.go | 1 + core_security_list_test.go | 4 +++- core_shape_datasource_test.go | 1 + core_subnet_datasource_test.go | 1 + core_subnet_test.go | 1 + core_virtual_network_datasource_test.go | 1 + core_virtual_network_test.go | 1 + core_vnic_attachment_datasource_test.go | 1 + core_vnic_datasource_test.go | 1 + core_volume_attachment_datasource_test.go | 1 + core_volume_attachment_test.go | 1 + core_volume_backup_datasource_test.go | 1 + core_volume_backup_test.go | 1 + core_volume_datasource_test.go | 1 + core_volume_test.go | 1 + crud/helpers.go | 8 +++++--- database/database_datasource.go | 3 ++- database/databases_datasource.go | 3 ++- database/databases_datasource_crud.go | 1 + database/db_home_datasource.go | 3 ++- database/db_homes_datasource.go | 3 ++- database/db_homes_datasource_crud.go | 1 + database/db_node_datasource.go | 3 ++- database/db_nodes_datasource.go | 3 ++- database/db_nodes_datasource_crud.go | 1 + database/db_system_datasource.go | 3 ++- database/db_system_datasource_crud.go | 1 + database/db_system_resource.go | 3 ++- database/db_system_shape_datasource.go | 3 ++- database/db_system_shape_datasource_crud.go | 1 + database/db_version_datasource.go | 3 ++- database/db_version_datasource_crud.go | 1 + database/supported_operations.go | 3 ++- database_database_datasource_test.go | 1 + database_databases_datasource_test.go | 1 + database_db_home_datasource_test.go | 1 + database_db_homes_datasource_test.go | 1 + database_db_node_datasource_test.go | 1 + database_db_nodes_datasource_test.go | 1 + database_db_system_datasource_test.go | 1 + database_db_system_shape_datasource_test.go | 1 + database_db_system_test.go | 1 + database_db_version_datasource_test.go | 1 + database_supported_operations_datasource_test.go | 1 + identity/api_key_datasource.go | 3 ++- identity/api_key_resource.go | 3 ++- identity/availability_domain_datasource.go | 5 +++-- identity/compartment_datasource.go | 5 +++-- identity/compartment_datasource_crud.go | 11 ++++++----- identity/compartment_resource.go | 3 ++- identity/compartment_resource_crud.go | 1 + identity/group_datasource.go | 5 +++-- identity/group_datasource_crud.go | 11 ++++++----- identity/group_resource.go | 3 ++- identity/group_resource_crud.go | 1 + identity/helpers.go | 5 ++--- identity/policy_datasource.go | 5 +++-- identity/policy_datasource_crud.go | 15 ++++++++------- identity/policy_resource.go | 3 ++- identity/policy_resource_crud.go | 1 + identity/swift_password_datasource.go | 5 +++-- identity/swift_password_datasource_crud.go | 13 +++++++------ identity/swift_password_resource.go | 9 +++++---- identity/swift_password_resource_crud.go | 2 +- identity/ui_password_resource.go | 3 ++- identity/ui_password_resource_crud.go | 1 + identity/user_datasource.go | 5 +++-- identity/user_datasource_crud.go | 11 ++++++----- identity/user_group_membership_resource.go | 5 +++-- identity/user_group_membership_resource_crud.go | 1 + identity/user_group_memberships_datasource.go | 9 +++++---- .../user_group_memberships_datasource_crud.go | 11 ++++++----- identity/user_resource.go | 3 ++- identity/user_resource_crud.go | 1 + identity_api_key_datasource_test.go | 1 + identity_api_key_test.go | 1 + identity_compartment_datasource_test.go | 1 + identity_compartment_test.go | 1 + identity_group_datasource_test.go | 1 + identity_group_test.go | 1 + identity_policy_datasource_test.go | 1 + identity_policy_test.go | 1 + identity_swift_password_datasource_test.go | 1 + identity_swift_password_test.go | 1 + identity_ui_password_test.go | 1 + identity_user_datasource_test.go | 1 + identity_user_group_membership_datasource_test.go | 1 + identity_user_test.go | 1 + objectstorage/bucket_resource.go | 3 ++- objectstorage/bucket_resource_crud.go | 1 + objectstorage/bucketsummary_datasource.go | 3 ++- objectstorage/bucketsummary_datasource_crud.go | 1 + objectstorage/namespace_datasource.go | 3 ++- objectstorage/namespace_datasource_crud.go | 1 + objectstorage/object_datasource.go | 3 ++- objectstorage/object_head_datasource.go | 3 ++- objectstorage/object_resource.go | 3 ++- objectstorage_bucket_resource_test.go | 1 + objectstorage_bucketsummary_datasource_test.go | 1 + objectstorage_namespace_datasource_test.go | 1 + objectstorage_object_datasource_test.go | 1 + objectstorage_object_head_datasource_test.go | 1 + objectstorage_object_resource_test.go | 1 + provider.go | 6 ++++-- 179 files changed, 308 insertions(+), 129 deletions(-) diff --git a/client_test.go b/client_test.go index 4b9b3a8cf26..aacf0f73fde 100644 --- a/client_test.go +++ b/client_test.go @@ -2,8 +2,9 @@ package main import ( "github.com/MustWin/baremetal-sdk-go" - "github.com/oracle/terraform-provider-baremetal/client" "github.com/stretchr/testify/suite" + + "github.com/oracle/terraform-provider-baremetal/client" ) type ResourceClientTestSuite struct { diff --git a/core/console_history_data_datasource.go b/core/console_history_data_datasource.go index 465955d5cf6..6e66b216a6f 100644 --- a/core/console_history_data_datasource.go +++ b/core/console_history_data_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func ConsoleHistoryDataDatasource() *schema.Resource { diff --git a/core/console_history_resource.go b/core/console_history_resource.go index ad535e5d9a3..06bf1e9803a 100644 --- a/core/console_history_resource.go +++ b/core/console_history_resource.go @@ -5,9 +5,10 @@ package core import ( "fmt" + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func ConsoleHistoryResource() *schema.Resource { diff --git a/core/console_history_resource_crud.go b/core/console_history_resource_crud.go index aad91f88595..3074f91c5b0 100644 --- a/core/console_history_resource_crud.go +++ b/core/console_history_resource_crud.go @@ -4,6 +4,7 @@ package core import ( "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/core/cpe_datasource.go b/core/cpe_datasource.go index e553aa965a9..106a405bf05 100644 --- a/core/cpe_datasource.go +++ b/core/cpe_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func CpeDatasource() *schema.Resource { diff --git a/core/cpe_datasource_crud.go b/core/cpe_datasource_crud.go index 8d9d9adb8e4..b4ca3651a51 100644 --- a/core/cpe_datasource_crud.go +++ b/core/cpe_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" "github.com/oracle/terraform-provider-baremetal/options" ) diff --git a/core/cpe_resource.go b/core/cpe_resource.go index 31e92138eab..997a199afe9 100644 --- a/core/cpe_resource.go +++ b/core/cpe_resource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func CpeResource() *schema.Resource { diff --git a/core/cpe_resource_crud.go b/core/cpe_resource_crud.go index d3df88637c8..7a2424fea46 100644 --- a/core/cpe_resource_crud.go +++ b/core/cpe_resource_crud.go @@ -4,6 +4,7 @@ package core import ( "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/core/dhcp_options_datasource.go b/core/dhcp_options_datasource.go index 279cfccb697..4bfe4e57052 100644 --- a/core/dhcp_options_datasource.go +++ b/core/dhcp_options_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DHCPOptionsDatasource() *schema.Resource { diff --git a/core/dhcp_options_datasource_crud.go b/core/dhcp_options_datasource_crud.go index e09fcdc2365..1c0bc7cc011 100644 --- a/core/dhcp_options_datasource_crud.go +++ b/core/dhcp_options_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" "github.com/oracle/terraform-provider-baremetal/options" ) diff --git a/core/dhcp_options_resource.go b/core/dhcp_options_resource.go index fc42b9a42d3..786dd8f1be6 100644 --- a/core/dhcp_options_resource.go +++ b/core/dhcp_options_resource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DHCPOptionsResource() *schema.Resource { diff --git a/core/dhcp_options_resource_crud.go b/core/dhcp_options_resource_crud.go index 0116eec73e3..6d2e5a7dd3a 100644 --- a/core/dhcp_options_resource_crud.go +++ b/core/dhcp_options_resource_crud.go @@ -4,6 +4,7 @@ package core import ( "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/core/drg_attachment_datasource.go b/core/drg_attachment_datasource.go index 57d848f2c99..01fbd2ff6d9 100644 --- a/core/drg_attachment_datasource.go +++ b/core/drg_attachment_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DrgAttachmentDatasource() *schema.Resource { diff --git a/core/drg_attachment_datasource_crud.go b/core/drg_attachment_datasource_crud.go index 6f81b481e09..5120e729d69 100644 --- a/core/drg_attachment_datasource_crud.go +++ b/core/drg_attachment_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" "github.com/oracle/terraform-provider-baremetal/options" ) diff --git a/core/drg_attachment_resource.go b/core/drg_attachment_resource.go index d1620e3adda..41efb3230b5 100644 --- a/core/drg_attachment_resource.go +++ b/core/drg_attachment_resource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DrgAttachmentResource() *schema.Resource { diff --git a/core/drg_attachment_resource_crud.go b/core/drg_attachment_resource_crud.go index 6a8b133f845..e2b7b51f526 100644 --- a/core/drg_attachment_resource_crud.go +++ b/core/drg_attachment_resource_crud.go @@ -4,6 +4,7 @@ package core import ( "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/core/drg_datasource.go b/core/drg_datasource.go index 5c40eff05b7..cd610eadf21 100644 --- a/core/drg_datasource.go +++ b/core/drg_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DrgDatasource() *schema.Resource { diff --git a/core/drg_datasource_crud.go b/core/drg_datasource_crud.go index bcfdb49fca0..8e993475f27 100644 --- a/core/drg_datasource_crud.go +++ b/core/drg_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" "github.com/oracle/terraform-provider-baremetal/options" ) diff --git a/core/drg_resource.go b/core/drg_resource.go index 0025e9db387..3c13da1da6d 100644 --- a/core/drg_resource.go +++ b/core/drg_resource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DrgResource() *schema.Resource { diff --git a/core/drg_resource_crud.go b/core/drg_resource_crud.go index 7dc9e954886..34cd714a29b 100644 --- a/core/drg_resource_crud.go +++ b/core/drg_resource_crud.go @@ -4,6 +4,7 @@ package core import ( "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/core/image_datasource.go b/core/image_datasource.go index 4d922d13d34..a5fb88bb6d9 100644 --- a/core/image_datasource.go +++ b/core/image_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func ImageDatasource() *schema.Resource { diff --git a/core/image_datasource_crud.go b/core/image_datasource_crud.go index 841570c806a..e64ff2c6d06 100644 --- a/core/image_datasource_crud.go +++ b/core/image_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" "github.com/oracle/terraform-provider-baremetal/options" ) diff --git a/core/image_resource.go b/core/image_resource.go index 83e09cccf67..3858d3eabd5 100644 --- a/core/image_resource.go +++ b/core/image_resource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func ImageResource() *schema.Resource { diff --git a/core/instance_datasource.go b/core/instance_datasource.go index 1aeb4e163a3..f947f57efc4 100644 --- a/core/instance_datasource.go +++ b/core/instance_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func InstanceDatasource() *schema.Resource { diff --git a/core/instance_resource.go b/core/instance_resource.go index 6c3c14efa30..217e06374d5 100644 --- a/core/instance_resource.go +++ b/core/instance_resource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func InstanceResource() *schema.Resource { diff --git a/core/instance_resource_crud.go b/core/instance_resource_crud.go index ca0185d5db3..fe174b5da5b 100644 --- a/core/instance_resource_crud.go +++ b/core/instance_resource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/core/internet_gateway_datasource.go b/core/internet_gateway_datasource.go index d4a70123974..3dd5919999c 100644 --- a/core/internet_gateway_datasource.go +++ b/core/internet_gateway_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func InternetGatewayDatasource() *schema.Resource { diff --git a/core/internet_gateway_datasource_crud.go b/core/internet_gateway_datasource_crud.go index 16f3011bf54..b1770c39658 100644 --- a/core/internet_gateway_datasource_crud.go +++ b/core/internet_gateway_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" "github.com/oracle/terraform-provider-baremetal/options" ) diff --git a/core/internet_gateway_resource.go b/core/internet_gateway_resource.go index ed7ce369883..ba6d800e907 100644 --- a/core/internet_gateway_resource.go +++ b/core/internet_gateway_resource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func InternetGatewayResource() *schema.Resource { diff --git a/core/ipsec_connection_config_datasource.go b/core/ipsec_connection_config_datasource.go index 954cb6644f2..1eb9840eb16 100644 --- a/core/ipsec_connection_config_datasource.go +++ b/core/ipsec_connection_config_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func IPSecConnectionConfigDatasource() *schema.Resource { diff --git a/core/ipsec_connection_resource.go b/core/ipsec_connection_resource.go index 431860ba56c..3b411ffae7a 100644 --- a/core/ipsec_connection_resource.go +++ b/core/ipsec_connection_resource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func IPSecConnectionResource() *schema.Resource { diff --git a/core/ipsec_connection_status_datasource.go b/core/ipsec_connection_status_datasource.go index e68774d5607..1bb3c37b134 100644 --- a/core/ipsec_connection_status_datasource.go +++ b/core/ipsec_connection_status_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func IPSecConnectionStatusDatasource() *schema.Resource { diff --git a/core/ipsec_connections_datasource.go b/core/ipsec_connections_datasource.go index bbf14eb778e..44df528a9a6 100644 --- a/core/ipsec_connections_datasource.go +++ b/core/ipsec_connections_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func IPSecConnectionsDatasource() *schema.Resource { diff --git a/core/route_table_datasource.go b/core/route_table_datasource.go index b39b2d9ee26..2c171a0a90e 100644 --- a/core/route_table_datasource.go +++ b/core/route_table_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func RouteTableDatasource() *schema.Resource { diff --git a/core/route_table_resource.go b/core/route_table_resource.go index 0a0a5b2e1fb..8d075cd8abc 100644 --- a/core/route_table_resource.go +++ b/core/route_table_resource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func RouteTableResource() *schema.Resource { diff --git a/core/security_list_datasource.go b/core/security_list_datasource.go index d5c57593f9e..05413ffc4d2 100644 --- a/core/security_list_datasource.go +++ b/core/security_list_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func SecurityListDatasource() *schema.Resource { diff --git a/core/security_list_resource.go b/core/security_list_resource.go index e932c835936..cea00c1218f 100644 --- a/core/security_list_resource.go +++ b/core/security_list_resource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) var transportSchema = &schema.Schema{ @@ -80,7 +81,7 @@ func SecurityListResource() *schema.Resource { "stateless": { Type: schema.TypeBool, Optional: true, - Default: false, + Default: false, }, }, }, @@ -108,7 +109,7 @@ func SecurityListResource() *schema.Resource { "stateless": { Type: schema.TypeBool, Optional: true, - Default: false, + Default: false, }, }, }, diff --git a/core/security_list_resource_crud.go b/core/security_list_resource_crud.go index 136e863c46e..68af55d8bf1 100644 --- a/core/security_list_resource_crud.go +++ b/core/security_list_resource_crud.go @@ -4,6 +4,7 @@ package core import ( "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/core/shape_datasource.go b/core/shape_datasource.go index d0ac28c1df5..67c78f4521d 100644 --- a/core/shape_datasource.go +++ b/core/shape_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func ShapeDatasource() *schema.Resource { diff --git a/core/subnet_datasource.go b/core/subnet_datasource.go index 479f7ede4ee..70fc27bfb09 100644 --- a/core/subnet_datasource.go +++ b/core/subnet_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func SubnetDatasource() *schema.Resource { diff --git a/core/subnet_resource.go b/core/subnet_resource.go index 57d3a7fbfd2..13adef5a65d 100644 --- a/core/subnet_resource.go +++ b/core/subnet_resource.go @@ -4,6 +4,7 @@ package core import ( "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/core/subnet_resource_crud.go b/core/subnet_resource_crud.go index aac0b4c801a..b40f988b669 100644 --- a/core/subnet_resource_crud.go +++ b/core/subnet_resource_crud.go @@ -7,6 +7,7 @@ import ( "github.com/MustWin/baremetal-sdk-go" "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/core/virtual_network_datasource.go b/core/virtual_network_datasource.go index 89b071b4a3c..36585bd5978 100644 --- a/core/virtual_network_datasource.go +++ b/core/virtual_network_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func VirtualNetworkDatasource() *schema.Resource { diff --git a/core/virtual_network_datasource_crud.go b/core/virtual_network_datasource_crud.go index ced6ce80084..949fb4bc3b5 100644 --- a/core/virtual_network_datasource_crud.go +++ b/core/virtual_network_datasource_crud.go @@ -53,7 +53,7 @@ func (s *VirtualNetworkDatasourceCrud) SetData() { res := map[string]string{ "cidr_block": v.CidrBlock, "compartment_id": v.CompartmentID, - "default_route_table_id": v.DefaultRouteTableID, + "default_route_table_id": v.DefaultRouteTableID, "default_security_list_id": v.DefaultSecurityListID, "display_name": v.DisplayName, "id": v.ID, diff --git a/core/virtual_network_resource.go b/core/virtual_network_resource.go index 81973698a50..d6ae8692032 100644 --- a/core/virtual_network_resource.go +++ b/core/virtual_network_resource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func VirtualNetworkResource() *schema.Resource { diff --git a/core/virtual_network_resource_crud.go b/core/virtual_network_resource_crud.go index 9c45e6ee58b..1428995eee3 100644 --- a/core/virtual_network_resource_crud.go +++ b/core/virtual_network_resource_crud.go @@ -4,6 +4,7 @@ package core import ( "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/core/vnic_attachment_datasource.go b/core/vnic_attachment_datasource.go index 30144954c2b..7cb1fb6f7f8 100644 --- a/core/vnic_attachment_datasource.go +++ b/core/vnic_attachment_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func resourceVnicAttachment() *schema.Resource { diff --git a/core/vnic_datasource.go b/core/vnic_datasource.go index 359a6188b2e..8d6fab17c64 100644 --- a/core/vnic_datasource.go +++ b/core/vnic_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func VnicDatasource() *schema.Resource { diff --git a/core/volume_attachment_datasource.go b/core/volume_attachment_datasource.go index 5f3dc8652b3..0844fa84141 100644 --- a/core/volume_attachment_datasource.go +++ b/core/volume_attachment_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func VolumeAttachmentDatasource() *schema.Resource { diff --git a/core/volume_backup_datasource.go b/core/volume_backup_datasource.go index 63df312c476..d48ab2c84df 100644 --- a/core/volume_backup_datasource.go +++ b/core/volume_backup_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func VolumeBackupDatasource() *schema.Resource { diff --git a/core/volume_backup_resource.go b/core/volume_backup_resource.go index 02e1f3fd52c..df86907f487 100644 --- a/core/volume_backup_resource.go +++ b/core/volume_backup_resource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func VolumeBackupResource() *schema.Resource { diff --git a/core/volume_datasource.go b/core/volume_datasource.go index 044f0d10abe..266973beed2 100644 --- a/core/volume_datasource.go +++ b/core/volume_datasource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func VolumeDatasource() *schema.Resource { diff --git a/core/volume_resource.go b/core/volume_resource.go index 5c9ca4ceb38..94824858494 100644 --- a/core/volume_resource.go +++ b/core/volume_resource.go @@ -3,9 +3,10 @@ package core import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func VolumeResource() *schema.Resource { diff --git a/core_console_history_data_datasource_test.go b/core_console_history_data_datasource_test.go index c32d36842b3..9a04910ada5 100644 --- a/core_console_history_data_datasource_test.go +++ b/core_console_history_data_datasource_test.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "crypto/rand" diff --git a/core_console_history_test.go b/core_console_history_test.go index 865cd13ca2b..09422b3dc49 100644 --- a/core_console_history_test.go +++ b/core_console_history_test.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_cpe_datasource_test.go b/core_cpe_datasource_test.go index abbad7f5cd7..8211904258e 100644 --- a/core_cpe_datasource_test.go +++ b/core_cpe_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_cpe_test.go b/core_cpe_test.go index 0e376777200..2ef07035338 100644 --- a/core_cpe_test.go +++ b/core_cpe_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_dhcp_options_datasource_test.go b/core_dhcp_options_datasource_test.go index b4a199dc614..1e40cb137ca 100644 --- a/core_dhcp_options_datasource_test.go +++ b/core_dhcp_options_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_dhcp_options_test.go b/core_dhcp_options_test.go index 22d4a3ca2e9..e29fda6a780 100644 --- a/core_dhcp_options_test.go +++ b/core_dhcp_options_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_drg_attachment_datasource_test.go b/core_drg_attachment_datasource_test.go index b1e19657876..4d9b38e2a3b 100644 --- a/core_drg_attachment_datasource_test.go +++ b/core_drg_attachment_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_drg_attachment_test.go b/core_drg_attachment_test.go index f923814271f..18289b9b9bb 100644 --- a/core_drg_attachment_test.go +++ b/core_drg_attachment_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_drg_datasource_test.go b/core_drg_datasource_test.go index 584792e453d..a489bd9ca5d 100644 --- a/core_drg_datasource_test.go +++ b/core_drg_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_drg_test.go b/core_drg_test.go index 652f53c0a00..a6fc491336b 100644 --- a/core_drg_test.go +++ b/core_drg_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_image_datasource_test.go b/core_image_datasource_test.go index 51d5678fe07..7be32ae58c9 100644 --- a/core_image_datasource_test.go +++ b/core_image_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_image_test.go b/core_image_test.go index 8f712277528..2263399bab6 100644 --- a/core_image_test.go +++ b/core_image_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_instance_datasource_test.go b/core_instance_datasource_test.go index 3d3b06930fd..04df5bc8c3e 100644 --- a/core_instance_datasource_test.go +++ b/core_instance_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_instance_test.go b/core_instance_test.go index 14f27ce846f..83b8fb94fc7 100644 --- a/core_instance_test.go +++ b/core_instance_test.go @@ -10,11 +10,13 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" + "github.com/stretchr/testify/suite" + "github.com/oracle/terraform-provider-baremetal/core" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/stretchr/testify/suite" ) type ResourceCoreInstanceTestSuite struct { diff --git a/core_internet_gateway_datasource_test.go b/core_internet_gateway_datasource_test.go index 4e5922437bc..69da8c6733e 100644 --- a/core_internet_gateway_datasource_test.go +++ b/core_internet_gateway_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_internet_gateway_test.go b/core_internet_gateway_test.go index b5221bc7d78..7e185e82c91 100644 --- a/core_internet_gateway_test.go +++ b/core_internet_gateway_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_ipsec_datasource_config_test.go b/core_ipsec_datasource_config_test.go index 337aa313f42..fcef0597c57 100644 --- a/core_ipsec_datasource_config_test.go +++ b/core_ipsec_datasource_config_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_ipsec_datasource_status_test.go b/core_ipsec_datasource_status_test.go index b7ef7a7602b..6691d92056e 100644 --- a/core_ipsec_datasource_status_test.go +++ b/core_ipsec_datasource_status_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_ipsec_datasource_test.go b/core_ipsec_datasource_test.go index 7b507136b3a..55209c2ce8e 100644 --- a/core_ipsec_datasource_test.go +++ b/core_ipsec_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_ipsec_test.go b/core_ipsec_test.go index 8467c0437a8..fcb2fc66ed9 100644 --- a/core_ipsec_test.go +++ b/core_ipsec_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_route_table_datasource_test.go b/core_route_table_datasource_test.go index 2233348ddee..c535458fd7f 100644 --- a/core_route_table_datasource_test.go +++ b/core_route_table_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_route_table_test.go b/core_route_table_test.go index be571df1543..ff3fbd8312f 100644 --- a/core_route_table_test.go +++ b/core_route_table_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_security_list_datasource_test.go b/core_security_list_datasource_test.go index 7dacea08eb5..2fda158a6bf 100644 --- a/core_security_list_datasource_test.go +++ b/core_security_list_datasource_test.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_security_list_test.go b/core_security_list_test.go index 1191d29930c..48da1334e19 100644 --- a/core_security_list_test.go +++ b/core_security_list_test.go @@ -10,10 +10,12 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" - "github.com/oracle/terraform-provider-baremetal/crud" "github.com/stretchr/testify/suite" + + "github.com/oracle/terraform-provider-baremetal/crud" ) type ResourceCoreSecurityListTestSuite struct { diff --git a/core_shape_datasource_test.go b/core_shape_datasource_test.go index 550b20ac8d8..7c9b7a541b3 100644 --- a/core_shape_datasource_test.go +++ b/core_shape_datasource_test.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_subnet_datasource_test.go b/core_subnet_datasource_test.go index 45005fdab33..2dfa472417f 100644 --- a/core_subnet_datasource_test.go +++ b/core_subnet_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_subnet_test.go b/core_subnet_test.go index cc74e5ea83c..be530f52294 100644 --- a/core_subnet_test.go +++ b/core_subnet_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_virtual_network_datasource_test.go b/core_virtual_network_datasource_test.go index 59a1092f84a..5a47d713bc3 100644 --- a/core_virtual_network_datasource_test.go +++ b/core_virtual_network_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_virtual_network_test.go b/core_virtual_network_test.go index 57e36178153..a9ecd0fe0de 100644 --- a/core_virtual_network_test.go +++ b/core_virtual_network_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "errors" diff --git a/core_vnic_attachment_datasource_test.go b/core_vnic_attachment_datasource_test.go index 2f57d8fbdb6..f50c3cadaa1 100644 --- a/core_vnic_attachment_datasource_test.go +++ b/core_vnic_attachment_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/oracle/terraform-provider-baremetal/crud" diff --git a/core_vnic_datasource_test.go b/core_vnic_datasource_test.go index 4f8f16dace6..9a54d465db6 100644 --- a/core_vnic_datasource_test.go +++ b/core_vnic_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_volume_attachment_datasource_test.go b/core_volume_attachment_datasource_test.go index 8f1d8e4e69e..3c72d3c71fc 100644 --- a/core_volume_attachment_datasource_test.go +++ b/core_volume_attachment_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_volume_attachment_test.go b/core_volume_attachment_test.go index 86bb88fdbc6..a8f61ffd73a 100644 --- a/core_volume_attachment_test.go +++ b/core_volume_attachment_test.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_volume_backup_datasource_test.go b/core_volume_backup_datasource_test.go index 3c25d9c6294..f223b5524ae 100644 --- a/core_volume_backup_datasource_test.go +++ b/core_volume_backup_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_volume_backup_test.go b/core_volume_backup_test.go index 937050eb3d9..929d8051582 100644 --- a/core_volume_backup_test.go +++ b/core_volume_backup_test.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_volume_datasource_test.go b/core_volume_datasource_test.go index 019b0f0b182..beecb7e591e 100644 --- a/core_volume_datasource_test.go +++ b/core_volume_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/core_volume_test.go b/core_volume_test.go index 5c5c9476213..68cb1adb555 100644 --- a/core_volume_test.go +++ b/core_volume_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/crud/helpers.go b/crud/helpers.go index 991af8f1c22..bd862323504 100644 --- a/crud/helpers.go +++ b/crud/helpers.go @@ -9,11 +9,13 @@ import ( "strings" "time" - "github.com/oracle/terraform-provider-baremetal/client" + "errors" + "strconv" + "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" - "strconv" - "errors" + + "github.com/oracle/terraform-provider-baremetal/client" ) const FiveMinutes time.Duration = 5 * time.Minute diff --git a/database/database_datasource.go b/database/database_datasource.go index 2ce073bc949..6ce381f6049 100644 --- a/database/database_datasource.go +++ b/database/database_datasource.go @@ -3,9 +3,10 @@ package database import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DatabaseDatasource() *schema.Resource { diff --git a/database/databases_datasource.go b/database/databases_datasource.go index 30fd09f5e20..8b00e91e052 100644 --- a/database/databases_datasource.go +++ b/database/databases_datasource.go @@ -3,9 +3,10 @@ package database import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DatabasesDatasource() *schema.Resource { diff --git a/database/databases_datasource_crud.go b/database/databases_datasource_crud.go index 23410b127a5..c03a2064674 100644 --- a/database/databases_datasource_crud.go +++ b/database/databases_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" "github.com/oracle/terraform-provider-baremetal/options" ) diff --git a/database/db_home_datasource.go b/database/db_home_datasource.go index cf0d9968b1c..7ed1587450b 100644 --- a/database/db_home_datasource.go +++ b/database/db_home_datasource.go @@ -3,9 +3,10 @@ package database import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DBHomeDatasource() *schema.Resource { diff --git a/database/db_homes_datasource.go b/database/db_homes_datasource.go index 99245f28b2e..d7109cb50a0 100644 --- a/database/db_homes_datasource.go +++ b/database/db_homes_datasource.go @@ -3,9 +3,10 @@ package database import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DBHomesDatasource() *schema.Resource { diff --git a/database/db_homes_datasource_crud.go b/database/db_homes_datasource_crud.go index 4da50a4a352..9fd68ef3873 100644 --- a/database/db_homes_datasource_crud.go +++ b/database/db_homes_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" "github.com/oracle/terraform-provider-baremetal/options" ) diff --git a/database/db_node_datasource.go b/database/db_node_datasource.go index 544aecce5c6..4c592833abd 100644 --- a/database/db_node_datasource.go +++ b/database/db_node_datasource.go @@ -3,9 +3,10 @@ package database import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DBNodeDatasource() *schema.Resource { diff --git a/database/db_nodes_datasource.go b/database/db_nodes_datasource.go index 36034072f06..48dde738407 100644 --- a/database/db_nodes_datasource.go +++ b/database/db_nodes_datasource.go @@ -3,9 +3,10 @@ package database import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DBNodesDatasource() *schema.Resource { diff --git a/database/db_nodes_datasource_crud.go b/database/db_nodes_datasource_crud.go index 67fa599c634..9c76aa3317d 100644 --- a/database/db_nodes_datasource_crud.go +++ b/database/db_nodes_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" "github.com/oracle/terraform-provider-baremetal/options" ) diff --git a/database/db_system_datasource.go b/database/db_system_datasource.go index ef3baf09ccd..6d709d2a6b3 100644 --- a/database/db_system_datasource.go +++ b/database/db_system_datasource.go @@ -3,9 +3,10 @@ package database import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DBSystemDatasource() *schema.Resource { diff --git a/database/db_system_datasource_crud.go b/database/db_system_datasource_crud.go index dc0eab9aeb2..f120e0858fb 100644 --- a/database/db_system_datasource_crud.go +++ b/database/db_system_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" "github.com/oracle/terraform-provider-baremetal/options" ) diff --git a/database/db_system_resource.go b/database/db_system_resource.go index 1ef73948cb1..06894e5fe7d 100644 --- a/database/db_system_resource.go +++ b/database/db_system_resource.go @@ -3,9 +3,10 @@ package database import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DBSystemResource() *schema.Resource { diff --git a/database/db_system_shape_datasource.go b/database/db_system_shape_datasource.go index d04258f1f50..8e85babcf58 100644 --- a/database/db_system_shape_datasource.go +++ b/database/db_system_shape_datasource.go @@ -3,9 +3,10 @@ package database import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DBSystemShapeDatasource() *schema.Resource { diff --git a/database/db_system_shape_datasource_crud.go b/database/db_system_shape_datasource_crud.go index c1fa3b16e79..7a78db9bd37 100644 --- a/database/db_system_shape_datasource_crud.go +++ b/database/db_system_shape_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" "github.com/oracle/terraform-provider-baremetal/options" ) diff --git a/database/db_version_datasource.go b/database/db_version_datasource.go index 34a23dc9608..e576e68e4b3 100644 --- a/database/db_version_datasource.go +++ b/database/db_version_datasource.go @@ -3,9 +3,10 @@ package database import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func DBVersionDatasource() *schema.Resource { diff --git a/database/db_version_datasource_crud.go b/database/db_version_datasource_crud.go index a9eddccc8c2..a88453a0297 100644 --- a/database/db_version_datasource_crud.go +++ b/database/db_version_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" "github.com/oracle/terraform-provider-baremetal/options" ) diff --git a/database/supported_operations.go b/database/supported_operations.go index 26924647128..a696622c6af 100644 --- a/database/supported_operations.go +++ b/database/supported_operations.go @@ -3,9 +3,10 @@ package database import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func SupportedOperationDatasource() *schema.Resource { diff --git a/database_database_datasource_test.go b/database_database_datasource_test.go index 6b45f80ce40..d32514e8f5b 100644 --- a/database_database_datasource_test.go +++ b/database_database_datasource_test.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/database_databases_datasource_test.go b/database_databases_datasource_test.go index 64cb767ba30..253c0cc628d 100644 --- a/database_databases_datasource_test.go +++ b/database_databases_datasource_test.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/database_db_home_datasource_test.go b/database_db_home_datasource_test.go index dc3bb3c1b0f..5b02c527cad 100644 --- a/database_db_home_datasource_test.go +++ b/database_db_home_datasource_test.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/database_db_homes_datasource_test.go b/database_db_homes_datasource_test.go index c59046be972..f0477ba7861 100644 --- a/database_db_homes_datasource_test.go +++ b/database_db_homes_datasource_test.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/database_db_node_datasource_test.go b/database_db_node_datasource_test.go index 56b258b2982..e64b62a56fb 100644 --- a/database_db_node_datasource_test.go +++ b/database_db_node_datasource_test.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/database_db_nodes_datasource_test.go b/database_db_nodes_datasource_test.go index b583ef46a46..677e0e6e30a 100644 --- a/database_db_nodes_datasource_test.go +++ b/database_db_nodes_datasource_test.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/database_db_system_datasource_test.go b/database_db_system_datasource_test.go index baac843eab2..0b6c9ffbb1e 100644 --- a/database_db_system_datasource_test.go +++ b/database_db_system_datasource_test.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/database_db_system_shape_datasource_test.go b/database_db_system_shape_datasource_test.go index ab5d85a671f..a530f54fc75 100644 --- a/database_db_system_shape_datasource_test.go +++ b/database_db_system_shape_datasource_test.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/database_db_system_test.go b/database_db_system_test.go index ab0ae461fab..04c381fbd53 100644 --- a/database_db_system_test.go +++ b/database_db_system_test.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/database_db_version_datasource_test.go b/database_db_version_datasource_test.go index be227e877ba..9cfb1575fc6 100644 --- a/database_db_version_datasource_test.go +++ b/database_db_version_datasource_test.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/database_supported_operations_datasource_test.go b/database_supported_operations_datasource_test.go index eb68a814c1d..be5ae468f4a 100644 --- a/database_supported_operations_datasource_test.go +++ b/database_supported_operations_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/identity/api_key_datasource.go b/identity/api_key_datasource.go index 8a1ccef829c..33614bfb542 100644 --- a/identity/api_key_datasource.go +++ b/identity/api_key_datasource.go @@ -3,9 +3,10 @@ package identity import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func APIKeyDatasource() *schema.Resource { diff --git a/identity/api_key_resource.go b/identity/api_key_resource.go index 6a9b676dbe1..b00b520b128 100644 --- a/identity/api_key_resource.go +++ b/identity/api_key_resource.go @@ -3,9 +3,10 @@ package identity import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func APIKeyResource() *schema.Resource { diff --git a/identity/availability_domain_datasource.go b/identity/availability_domain_datasource.go index 7b30cfd0aa8..ac7f8385df6 100644 --- a/identity/availability_domain_datasource.go +++ b/identity/availability_domain_datasource.go @@ -3,9 +3,10 @@ package identity import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func AvailabilityDomainDatasource() *schema.Resource { @@ -19,7 +20,7 @@ func AvailabilityDomainDatasource() *schema.Resource { "availability_domains": { Type: schema.TypeList, Computed: true, - Elem: &schema.Resource{ + Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "compartment_id": { Type: schema.TypeString, diff --git a/identity/compartment_datasource.go b/identity/compartment_datasource.go index aab1414caed..93dab6e14a7 100644 --- a/identity/compartment_datasource.go +++ b/identity/compartment_datasource.go @@ -3,16 +3,17 @@ package identity import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func CompartmentDatasource() *schema.Resource { return &schema.Resource{ Read: readCompartments, Schema: map[string]*schema.Schema{ - "compartment_id":{ + "compartment_id": { Type: schema.TypeString, Required: true, }, diff --git a/identity/compartment_datasource_crud.go b/identity/compartment_datasource_crud.go index 2bacb2fe793..77cee34b00d 100644 --- a/identity/compartment_datasource_crud.go +++ b/identity/compartment_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) @@ -26,12 +27,12 @@ func (s *CompartmentDatasourceCrud) SetData() { for _, v := range s.Res.Compartments { res := map[string]interface{}{ "compartment_id": v.CompartmentID, - "description": v.Description, - "id": v.ID, + "description": v.Description, + "id": v.ID, "inactive_state": v.InactiveStatus, - "name": v.Name, - "state": v.State, - "time_created": v.TimeCreated.String(), + "name": v.Name, + "state": v.State, + "time_created": v.TimeCreated.String(), } resources = append(resources, res) } diff --git a/identity/compartment_resource.go b/identity/compartment_resource.go index 4b3338a97b4..76f30e57e72 100644 --- a/identity/compartment_resource.go +++ b/identity/compartment_resource.go @@ -5,9 +5,10 @@ package identity import ( "fmt" + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) // ResourceIdentityCompartment exposes an IdentityCompartment Resource diff --git a/identity/compartment_resource_crud.go b/identity/compartment_resource_crud.go index 926818b01b6..fa4f948cfef 100644 --- a/identity/compartment_resource_crud.go +++ b/identity/compartment_resource_crud.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/identity/group_datasource.go b/identity/group_datasource.go index d7965de802f..2b7e474ca82 100644 --- a/identity/group_datasource.go +++ b/identity/group_datasource.go @@ -3,16 +3,17 @@ package identity import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func GroupDatasource() *schema.Resource { return &schema.Resource{ Read: readGroups, Schema: map[string]*schema.Schema{ - "compartment_id":{ + "compartment_id": { Type: schema.TypeString, Required: true, }, diff --git a/identity/group_datasource_crud.go b/identity/group_datasource_crud.go index 8cabe7af0ff..ae03cb00052 100644 --- a/identity/group_datasource_crud.go +++ b/identity/group_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) @@ -26,12 +27,12 @@ func (s *GroupDatasourceCrud) SetData() { for _, v := range s.Res.Groups { res := map[string]interface{}{ "compartment_id": v.CompartmentID, - "description": v.Description, - "id": v.ID, + "description": v.Description, + "id": v.ID, "inactive_state": v.InactiveStatus, - "name": v.Name, - "state": v.State, - "time_created": v.TimeCreated.String(), + "name": v.Name, + "state": v.State, + "time_created": v.TimeCreated.String(), } resources = append(resources, res) } diff --git a/identity/group_resource.go b/identity/group_resource.go index 2e37f3b8bcd..b54388d3577 100644 --- a/identity/group_resource.go +++ b/identity/group_resource.go @@ -3,9 +3,10 @@ package identity import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) // ResourceIdentityGroup exposes an IdentityGroup Resource diff --git a/identity/group_resource_crud.go b/identity/group_resource_crud.go index 3a187d6d019..1e5ade756c1 100644 --- a/identity/group_resource_crud.go +++ b/identity/group_resource_crud.go @@ -4,6 +4,7 @@ package identity import ( "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/identity/helpers.go b/identity/helpers.go index a3e39d76b4d..10631ae0022 100644 --- a/identity/helpers.go +++ b/identity/helpers.go @@ -6,7 +6,7 @@ import "github.com/hashicorp/terraform/helper/schema" var baseIdentitySchemaWithID = map[string]*schema.Schema{ "id": { - Type: schema.TypeString, + Type: schema.TypeString, Computed: true, ForceNew: true, }, @@ -100,7 +100,7 @@ var identitySchema = map[string]*schema.Schema{ var identitySchemaWithID = map[string]*schema.Schema{ "id": { - Type: schema.TypeString, + Type: schema.TypeString, Computed: true, ForceNew: true, }, @@ -130,4 +130,3 @@ var identitySchemaWithID = map[string]*schema.Schema{ Computed: true, }, } - diff --git a/identity/policy_datasource.go b/identity/policy_datasource.go index 2256fc4a7c9..7231580772a 100644 --- a/identity/policy_datasource.go +++ b/identity/policy_datasource.go @@ -3,16 +3,17 @@ package identity import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func PolicyDatasource() *schema.Resource { return &schema.Resource{ Read: readPolicies, Schema: map[string]*schema.Schema{ - "compartment_id":{ + "compartment_id": { Type: schema.TypeString, Required: true, }, diff --git a/identity/policy_datasource_crud.go b/identity/policy_datasource_crud.go index 699799454c3..f8958c64e94 100644 --- a/identity/policy_datasource_crud.go +++ b/identity/policy_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) @@ -27,15 +28,15 @@ func (s *PolicyDatasourceCrud) SetData() { resources := []map[string]interface{}{} for _, v := range s.Res.Policies { res := map[string]interface{}{ - "id": v.ID, + "id": v.ID, "compartment_id": v.CompartmentID, - "name": v.Name, - "statements": v.Statements, - "description": v.Description, - "time_created": v.TimeCreated.String(), - "state": v.State, + "name": v.Name, + "statements": v.Statements, + "description": v.Description, + "time_created": v.TimeCreated.String(), + "state": v.State, "inactive_state": v.InactiveStatus, - "version_date": v.VersionDate.String(), + "version_date": v.VersionDate.String(), } resources = append(resources, res) } diff --git a/identity/policy_resource.go b/identity/policy_resource.go index ba2c204034e..2f4bae7f305 100644 --- a/identity/policy_resource.go +++ b/identity/policy_resource.go @@ -3,9 +3,10 @@ package identity import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func PolicyResource() *schema.Resource { diff --git a/identity/policy_resource_crud.go b/identity/policy_resource_crud.go index a8b1d7ec11e..2962d46579b 100644 --- a/identity/policy_resource_crud.go +++ b/identity/policy_resource_crud.go @@ -4,6 +4,7 @@ package identity import ( "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/identity/swift_password_datasource.go b/identity/swift_password_datasource.go index f3d76696c9f..a229d0b3220 100644 --- a/identity/swift_password_datasource.go +++ b/identity/swift_password_datasource.go @@ -3,16 +3,17 @@ package identity import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func SwiftPasswordDatasource() *schema.Resource { return &schema.Resource{ Read: readSwiftPasswords, Schema: map[string]*schema.Schema{ - "user_id":{ + "user_id": { Type: schema.TypeString, Required: true, }, diff --git a/identity/swift_password_datasource_crud.go b/identity/swift_password_datasource_crud.go index 849f8b7a825..7876a7b355e 100644 --- a/identity/swift_password_datasource_crud.go +++ b/identity/swift_password_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) @@ -27,13 +28,13 @@ func (s *SwiftPasswordDatasourceCrud) SetData() { resources := []map[string]interface{}{} for _, v := range s.Res.SwiftPasswords { res := map[string]interface{}{ - "id": v.ID, - "user_id": v.UserID, - "description": v.Description, - "state": v.State, + "id": v.ID, + "user_id": v.UserID, + "description": v.Description, + "state": v.State, "inactive_state": v.InactiveStatus, - "time_created": v.TimeCreated.String(), - "expires_on": v.ExpiresOn.String(), + "time_created": v.TimeCreated.String(), + "expires_on": v.ExpiresOn.String(), } resources = append(resources, res) } diff --git a/identity/swift_password_resource.go b/identity/swift_password_resource.go index a270aa7a3b9..619d790e13e 100644 --- a/identity/swift_password_resource.go +++ b/identity/swift_password_resource.go @@ -3,16 +3,17 @@ package identity import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func SwiftPasswordResource() *schema.Resource { return &schema.Resource{ Create: createSwiftPassword, - Read: readSwiftPassword, - Update: updateSwiftPassword, + Read: readSwiftPassword, + Update: updateSwiftPassword, Delete: deleteSwiftPassword, Schema: map[string]*schema.Schema{ "id": { @@ -82,4 +83,4 @@ func deleteSwiftPassword(d *schema.ResourceData, m interface{}) (e error) { sync.D = d sync.Client = client return crud.DeleteResource(sync) -} \ No newline at end of file +} diff --git a/identity/swift_password_resource_crud.go b/identity/swift_password_resource_crud.go index 5469350f7a3..e40ace3c58c 100644 --- a/identity/swift_password_resource_crud.go +++ b/identity/swift_password_resource_crud.go @@ -4,6 +4,7 @@ package identity import ( "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) @@ -16,7 +17,6 @@ func (s *SwiftPasswordResourceCrud) ID() string { return s.Res.ID } - func (s *SwiftPasswordResourceCrud) Get() (e error) { // There is no get resource for swift passwords, so we list them all and match id := s.D.Id() diff --git a/identity/ui_password_resource.go b/identity/ui_password_resource.go index d8cacb2ae39..700e2a8f2bb 100644 --- a/identity/ui_password_resource.go +++ b/identity/ui_password_resource.go @@ -3,9 +3,10 @@ package identity import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) // Version is exposed to allow resetting an existing user's password. diff --git a/identity/ui_password_resource_crud.go b/identity/ui_password_resource_crud.go index 924976f7149..ee2c3916fdc 100644 --- a/identity/ui_password_resource_crud.go +++ b/identity/ui_password_resource_crud.go @@ -4,6 +4,7 @@ package identity import ( "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/identity/user_datasource.go b/identity/user_datasource.go index 3239ca94d27..397e553ac37 100644 --- a/identity/user_datasource.go +++ b/identity/user_datasource.go @@ -3,16 +3,17 @@ package identity import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func UserDatasource() *schema.Resource { return &schema.Resource{ Read: readUsers, Schema: map[string]*schema.Schema{ - "compartment_id":{ + "compartment_id": { Type: schema.TypeString, Required: true, }, diff --git a/identity/user_datasource_crud.go b/identity/user_datasource_crud.go index 2d47021482b..09593861f7d 100644 --- a/identity/user_datasource_crud.go +++ b/identity/user_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) @@ -26,12 +27,12 @@ func (s *UserDatasourceCrud) SetData() { for _, v := range s.Res.Users { res := map[string]interface{}{ "compartment_id": v.CompartmentID, - "description": v.Description, - "id": v.ID, + "description": v.Description, + "id": v.ID, "inactive_state": v.InactiveStatus, - "name": v.Name, - "state": v.State, - "time_created": v.TimeCreated.String(), + "name": v.Name, + "state": v.State, + "time_created": v.TimeCreated.String(), } resources = append(resources, res) } diff --git a/identity/user_group_membership_resource.go b/identity/user_group_membership_resource.go index 2644193e0df..a35bbeb901d 100644 --- a/identity/user_group_membership_resource.go +++ b/identity/user_group_membership_resource.go @@ -3,9 +3,10 @@ package identity import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func UserGroupMembershipResource() *schema.Resource { @@ -15,7 +16,7 @@ func UserGroupMembershipResource() *schema.Resource { Delete: deleteUserGroupMembership, Schema: map[string]*schema.Schema{ "id": { - Type: schema.TypeString, + Type: schema.TypeString, Computed: true, ForceNew: true, }, diff --git a/identity/user_group_membership_resource_crud.go b/identity/user_group_membership_resource_crud.go index 9b24936f2a2..c1041e5a9d6 100644 --- a/identity/user_group_membership_resource_crud.go +++ b/identity/user_group_membership_resource_crud.go @@ -4,6 +4,7 @@ package identity import ( "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/identity/user_group_memberships_datasource.go b/identity/user_group_memberships_datasource.go index 46dc23798ad..cd624adc1d7 100644 --- a/identity/user_group_memberships_datasource.go +++ b/identity/user_group_memberships_datasource.go @@ -3,24 +3,25 @@ package identity import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func UserGroupMembershipDatasource() *schema.Resource { return &schema.Resource{ Read: readUserGroupMemberships, Schema: map[string]*schema.Schema{ - "compartment_id":{ + "compartment_id": { Type: schema.TypeString, Required: true, }, - "user_id":{ + "user_id": { Type: schema.TypeString, Optional: true, }, - "group_id":{ + "group_id": { Type: schema.TypeString, Optional: true, }, diff --git a/identity/user_group_memberships_datasource_crud.go b/identity/user_group_memberships_datasource_crud.go index f4b46ac306f..7f1cca5e390 100644 --- a/identity/user_group_memberships_datasource_crud.go +++ b/identity/user_group_memberships_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) @@ -26,12 +27,12 @@ func (s *UserGroupMembershipDatasourceCrud) SetData() { for _, v := range s.Res.Memberships { res := map[string]interface{}{ "compartment_id": v.CompartmentID, - "id": v.ID, - "user_id": v.UserID, - "group_id": v.GroupID, + "id": v.ID, + "user_id": v.UserID, + "group_id": v.GroupID, "inactive_state": v.InactiveStatus, - "state": v.State, - "time_created": v.TimeCreated.String(), + "state": v.State, + "time_created": v.TimeCreated.String(), } resources = append(resources, res) } diff --git a/identity/user_resource.go b/identity/user_resource.go index 206390723a4..a4194b9c768 100644 --- a/identity/user_resource.go +++ b/identity/user_resource.go @@ -3,9 +3,10 @@ package identity import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) // ResourceIdentityUser exposes a IdentityUser Resource diff --git a/identity/user_resource_crud.go b/identity/user_resource_crud.go index b9d66fa1dc1..5886dd4dca1 100644 --- a/identity/user_resource_crud.go +++ b/identity/user_resource_crud.go @@ -4,6 +4,7 @@ package identity import ( "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/identity_api_key_datasource_test.go b/identity_api_key_datasource_test.go index 5470e2dbab2..e6c353d0bd6 100644 --- a/identity_api_key_datasource_test.go +++ b/identity_api_key_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/identity_api_key_test.go b/identity_api_key_test.go index 59c99f3b9a9..aeab0b8082a 100644 --- a/identity_api_key_test.go +++ b/identity_api_key_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/identity_compartment_datasource_test.go b/identity_compartment_datasource_test.go index 9d9d57ba9c6..4ffe0385dba 100644 --- a/identity_compartment_datasource_test.go +++ b/identity_compartment_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/identity_compartment_test.go b/identity_compartment_test.go index c26b93ef0c3..4a6c1b65579 100644 --- a/identity_compartment_test.go +++ b/identity_compartment_test.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/identity_group_datasource_test.go b/identity_group_datasource_test.go index 82fb7f1b9e2..39703cbefd2 100644 --- a/identity_group_datasource_test.go +++ b/identity_group_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/identity_group_test.go b/identity_group_test.go index 17e79758a3f..9b148f7af93 100644 --- a/identity_group_test.go +++ b/identity_group_test.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/identity_policy_datasource_test.go b/identity_policy_datasource_test.go index 45195b06843..f26aec8ca49 100644 --- a/identity_policy_datasource_test.go +++ b/identity_policy_datasource_test.go @@ -13,6 +13,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/client/mocks" ) diff --git a/identity_policy_test.go b/identity_policy_test.go index 50718b2d1d4..836be3b78dc 100644 --- a/identity_policy_test.go +++ b/identity_policy_test.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/identity_swift_password_datasource_test.go b/identity_swift_password_datasource_test.go index ed87f704a63..d74e1cfc622 100644 --- a/identity_swift_password_datasource_test.go +++ b/identity_swift_password_datasource_test.go @@ -14,6 +14,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/client/mocks" ) diff --git a/identity_swift_password_test.go b/identity_swift_password_test.go index bc24fbde89f..4e2df31dabb 100644 --- a/identity_swift_password_test.go +++ b/identity_swift_password_test.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/client/mocks" ) diff --git a/identity_ui_password_test.go b/identity_ui_password_test.go index 23332af442a..6122d8a8e38 100644 --- a/identity_ui_password_test.go +++ b/identity_ui_password_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/identity_user_datasource_test.go b/identity_user_datasource_test.go index 72bb8f0cd9a..ef77fef03df 100644 --- a/identity_user_datasource_test.go +++ b/identity_user_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/identity_user_group_membership_datasource_test.go b/identity_user_group_membership_datasource_test.go index 9c885b11dfc..731cd983886 100644 --- a/identity_user_group_membership_datasource_test.go +++ b/identity_user_group_membership_datasource_test.go @@ -13,6 +13,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/client/mocks" ) diff --git a/identity_user_test.go b/identity_user_test.go index d43d0518364..35f8a5f4f9c 100644 --- a/identity_user_test.go +++ b/identity_user_test.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/objectstorage/bucket_resource.go b/objectstorage/bucket_resource.go index db38771bdbc..625d0818695 100644 --- a/objectstorage/bucket_resource.go +++ b/objectstorage/bucket_resource.go @@ -3,9 +3,10 @@ package objectstorage import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func BucketResource() *schema.Resource { diff --git a/objectstorage/bucket_resource_crud.go b/objectstorage/bucket_resource_crud.go index 0a299c32903..6141fb2f6a9 100644 --- a/objectstorage/bucket_resource_crud.go +++ b/objectstorage/bucket_resource_crud.go @@ -4,6 +4,7 @@ package objectstorage import ( "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/objectstorage/bucketsummary_datasource.go b/objectstorage/bucketsummary_datasource.go index 6ca27677a96..b47298369b3 100644 --- a/objectstorage/bucketsummary_datasource.go +++ b/objectstorage/bucketsummary_datasource.go @@ -3,9 +3,10 @@ package objectstorage import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func BucketSummaryDatasource() *schema.Resource { diff --git a/objectstorage/bucketsummary_datasource_crud.go b/objectstorage/bucketsummary_datasource_crud.go index 9defda5f969..4e616ef9555 100644 --- a/objectstorage/bucketsummary_datasource_crud.go +++ b/objectstorage/bucketsummary_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" "github.com/oracle/terraform-provider-baremetal/options" ) diff --git a/objectstorage/namespace_datasource.go b/objectstorage/namespace_datasource.go index 02b2ddd605d..e6d9f3b63e9 100644 --- a/objectstorage/namespace_datasource.go +++ b/objectstorage/namespace_datasource.go @@ -3,9 +3,10 @@ package objectstorage import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func NamespaceDatasource() *schema.Resource { diff --git a/objectstorage/namespace_datasource_crud.go b/objectstorage/namespace_datasource_crud.go index f3bb4dc0de0..036fc8114b0 100644 --- a/objectstorage/namespace_datasource_crud.go +++ b/objectstorage/namespace_datasource_crud.go @@ -6,6 +6,7 @@ import ( "time" "github.com/MustWin/baremetal-sdk-go" + "github.com/oracle/terraform-provider-baremetal/crud" ) diff --git a/objectstorage/object_datasource.go b/objectstorage/object_datasource.go index 67137916c1d..e03f546d843 100644 --- a/objectstorage/object_datasource.go +++ b/objectstorage/object_datasource.go @@ -3,9 +3,10 @@ package objectstorage import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func ObjectDatasource() *schema.Resource { diff --git a/objectstorage/object_head_datasource.go b/objectstorage/object_head_datasource.go index 8d5781df0d5..0fcea98868f 100644 --- a/objectstorage/object_head_datasource.go +++ b/objectstorage/object_head_datasource.go @@ -3,9 +3,10 @@ package objectstorage import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func ObjectHeadDatasource() *schema.Resource { diff --git a/objectstorage/object_resource.go b/objectstorage/object_resource.go index 72277f5d11b..8a1faa2e3dc 100644 --- a/objectstorage/object_resource.go +++ b/objectstorage/object_resource.go @@ -3,9 +3,10 @@ package objectstorage import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/oracle/terraform-provider-baremetal/client" "github.com/oracle/terraform-provider-baremetal/crud" - "github.com/hashicorp/terraform/helper/schema" ) func ObjectResource() *schema.Resource { diff --git a/objectstorage_bucket_resource_test.go b/objectstorage_bucket_resource_test.go index a411cc20c3f..fd8ac9318e4 100644 --- a/objectstorage_bucket_resource_test.go +++ b/objectstorage_bucket_resource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/objectstorage_bucketsummary_datasource_test.go b/objectstorage_bucketsummary_datasource_test.go index 6c3c0964b35..d59474ccc5d 100644 --- a/objectstorage_bucketsummary_datasource_test.go +++ b/objectstorage_bucketsummary_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/objectstorage_namespace_datasource_test.go b/objectstorage_namespace_datasource_test.go index fc34bfca83f..903989dab5e 100644 --- a/objectstorage_namespace_datasource_test.go +++ b/objectstorage_namespace_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/objectstorage_object_datasource_test.go b/objectstorage_object_datasource_test.go index 21b665ba32c..3a4b29b3bac 100644 --- a/objectstorage_object_datasource_test.go +++ b/objectstorage_object_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/objectstorage_object_head_datasource_test.go b/objectstorage_object_head_datasource_test.go index 4e7836d64f5..ead02acb8dd 100644 --- a/objectstorage_object_head_datasource_test.go +++ b/objectstorage_object_head_datasource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/objectstorage_object_resource_test.go b/objectstorage_object_resource_test.go index 5f386b015d4..23c2e5e9d5b 100644 --- a/objectstorage_object_resource_test.go +++ b/objectstorage_object_resource_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/client/mocks" "github.com/stretchr/testify/suite" diff --git a/provider.go b/provider.go index 288351ffb4f..5422a121c85 100644 --- a/provider.go +++ b/provider.go @@ -7,15 +7,17 @@ import ( "fmt" "net/http" + "os" + "strconv" + "github.com/MustWin/baremetal-sdk-go" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/terraform" + "github.com/oracle/terraform-provider-baremetal/core" "github.com/oracle/terraform-provider-baremetal/database" "github.com/oracle/terraform-provider-baremetal/identity" "github.com/oracle/terraform-provider-baremetal/objectstorage" - "os" - "strconv" ) var descriptions map[string]string From 1a5c82536905b319c3fdbd4af519af04aa91d1d2 Mon Sep 17 00:00:00 2001 From: Mike Ihbe Date: Mon, 3 Apr 2017 21:14:34 -0700 Subject: [PATCH 08/14] Add dhcpOptionsID and dnsLabel to the subnet resource. Closes #50 --- core/subnet_resource.go | 4 ++++ core/subnet_resource_crud.go | 9 ++++++++- .../MustWin/baremetal-sdk-go/request_options.go | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/subnet_resource.go b/core/subnet_resource.go index c71da6ac76a..0623d3d5804 100644 --- a/core/subnet_resource.go +++ b/core/subnet_resource.go @@ -58,6 +58,10 @@ func SubnetResource() *schema.Resource { Optional: true, Computed: true, }, + "dhcp_options_id": { + Type: schema.TypeString, + Optional: true, + }, "id": { Type: schema.TypeString, Computed: true, diff --git a/core/subnet_resource_crud.go b/core/subnet_resource_crud.go index 652b8094232..f541e92e4dd 100644 --- a/core/subnet_resource_crud.go +++ b/core/subnet_resource_crud.go @@ -45,7 +45,12 @@ func (s *SubnetResourceCrud) Create() (e error) { vcnID := s.D.Get("vcn_id").(string) opts := &baremetal.CreateSubnetOptions{} - + if dhcpOptionsID, ok := s.D.GetOk("dhcp_options_id"); ok { + opts.DHCPOptionsID = dhcpOptionsID.(string) + } + if dnsLabel, ok := s.D.GetOk("dns_label"); ok { + opts.DNSLabel = dnsLabel.(string) + } if displayName, ok := s.D.GetOk("display_name"); ok { opts.DisplayName = displayName.(string) } @@ -101,6 +106,8 @@ func (s *SubnetResourceCrud) SetData() { s.D.Set("display_name", s.Resource.DisplayName) s.D.Set("dns_label", s.Resource.DNSLabel) s.D.Set("cidr_block", s.Resource.CIDRBlock) + s.D.Set("dhcp_options_id", s.Resource.DHCPOptionsID) + s.D.Set("dns_label", s.Resource.DNSLabel) s.D.Set("route_table_id", s.Resource.RouteTableID) s.D.Set("vcn_id", s.Resource.VcnID) s.D.Set("security_list_ids", s.Resource.SecurityListIDs) diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go b/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go index c55bc7e7ad1..f744cec07df 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go @@ -60,6 +60,7 @@ type CreateVcnOptions struct { type CreateSubnetOptions struct { CreateOptions + DNSLabel string `header:"-" json:"dnsLabel,omitempty" url:"-"` DHCPOptionsID string `header:"-" json:"dhcpOptionsId,omitempty" url:"-"` DNSLabel string `header:"-" json:"dnsLabel,omitempty" url:"-"` RouteTableID string `header:"-" json:"routeTableId,omitempty" url:"-"` From f4316fa244d521fec9ce2f4817bec7ce2b7189cc Mon Sep 17 00:00:00 2001 From: Mike Ihbe Date: Mon, 3 Apr 2017 21:42:43 -0700 Subject: [PATCH 09/14] Add stateless attribute to security list --- core/security_list_resource.go | 5 +++++ core/security_list_resource_crud.go | 1 + 2 files changed, 6 insertions(+) diff --git a/core/security_list_resource.go b/core/security_list_resource.go index 5a8c7699f7c..e932c835936 100644 --- a/core/security_list_resource.go +++ b/core/security_list_resource.go @@ -105,6 +105,11 @@ func SecurityListResource() *schema.Resource { }, "tcp_options": transportSchema, "udp_options": transportSchema, + "stateless": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, }, }, }, diff --git a/core/security_list_resource_crud.go b/core/security_list_resource_crud.go index c4f065b8fba..136e863c46e 100644 --- a/core/security_list_resource_crud.go +++ b/core/security_list_resource_crud.go @@ -144,6 +144,7 @@ func (s *SecurityListResourceCrud) buildIngressRules() (sdkRules []baremetal.Ing Source: confRule["source"].(string), TCPOptions: s.buildTCPOptions(confRule), UDPOptions: s.buildUDPOptions(confRule), + IsStateless: confRule["stateless"].(bool), } sdkRules = append(sdkRules, sdkRule) From ec61a80edcd01b3f4458cbee37083ad8f8b53495 Mon Sep 17 00:00:00 2001 From: Mike Ihbe Date: Mon, 3 Apr 2017 22:44:20 -0700 Subject: [PATCH 10/14] Pick subnet changes --- core/route_table_resource.go | 4 +- .../MustWin/baremetal-sdk-go/Makefile | 3 + .../MustWin/baremetal-sdk-go/constants.go | 81 +++++--- .../baremetal-sdk-go/core_security_list.go | 1 + .../baremetal-sdk-go/loadbalancer_backend.go | 180 +++++++++++++++++ .../loadbalancer_backendset.go | 182 ++++++++++++++++++ .../loadbalancer_certificate.go | 123 ++++++++++++ .../loadbalancer_healthchecker.go | 78 ++++++++ .../baremetal-sdk-go/loadbalancer_listener.go | 118 ++++++++++++ .../loadbalancer_loadbalancer.go | 171 ++++++++++++++++ .../baremetal-sdk-go/loadbalancer_policy.go | 50 +++++ .../baremetal-sdk-go/loadbalancer_protocol.go | 50 +++++ .../baremetal-sdk-go/loadbalancer_shape.go | 51 +++++ .../loadbalancer_workrequest.go | 89 +++++++++ .../baremetal-sdk-go/request_options.go | 47 +++++ .../MustWin/baremetal-sdk-go/requestor.go | 12 +- .../MustWin/baremetal-sdk-go/response.go | 6 + .../response_unmarshallers.go | 12 ++ vendor/vendor.json | 6 +- 19 files changed, 1225 insertions(+), 39 deletions(-) create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backend.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backendset.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_certificate.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_healthchecker.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_listener.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_loadbalancer.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_policy.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_protocol.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_shape.go create mode 100644 vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_workrequest.go diff --git a/core/route_table_resource.go b/core/route_table_resource.go index 9dc6ab210a4..0a0a5b2e1fb 100644 --- a/core/route_table_resource.go +++ b/core/route_table_resource.go @@ -36,11 +36,11 @@ func RouteTableResource() *schema.Resource { Schema: map[string]*schema.Schema{ "cidr_block": { Type: schema.TypeString, - Required: true, + Optional: true, }, "network_entity_id": { Type: schema.TypeString, - Required: true, + Optional: true, }, }, }, diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/Makefile b/vendor/github.com/MustWin/baremetal-sdk-go/Makefile index 5f095fad900..b24243b1348 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/Makefile +++ b/vendor/github.com/MustWin/baremetal-sdk-go/Makefile @@ -47,6 +47,9 @@ record_core_test: record_core_instance_test: @go test -v -tags "recording core_instance" github.com/MustWin/baremetal-sdk-go/acceptance-test +record_load_balancer_test: + @go test -v -tags "recording load_balancer" github.com/MustWin/baremetal-sdk-go/acceptance-test + .PHONY: build test regression_test identity_test core_test database_test object_test acceptance_test \ record_identity_user_test record_identity_group_test record_identity_user_group_membership_test \ record_core_test record_identity_policy_test diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/constants.go b/vendor/github.com/MustWin/baremetal-sdk-go/constants.go index a5c0723e864..7d476f65d7e 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/constants.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/constants.go @@ -14,36 +14,43 @@ type ListObjectOptionField string const ( // Resource States - ResourceActive = "ACTIVE" - ResourceAttached = "ATTACHED" - ResourceAttaching = "ATTACHING" - ResourceAvailable = "AVAILABLE" - ResourceCreated = "CREATED" - ResourceCreating = "CREATING" - ResourceCreatingImage = "CREATING_IMAGE" - ResourceDeleting = "DELETING" - ResourceDeleted = "DELETED" - ResourceDetached = "DETACHED" - ResourceDetaching = "DETACHING" - ResourceDisabled = "DISABLED" - ResourceDown = "DOWN" - ResourceDownForMaintenance = "DOWN_FOR_MAINTENANCE" - ResourceFailed = "FAILED" - ResourceFaulty = "FAULTY" - ResourceGettingHistory = "GETTING-HISTORY" - ResourceInactive = "INACTIVE" - ResourceProvisioning = "PROVISIONING" - ResourceRequested = "REQUESTED" - ResourceRequestReceived = "REQUEST_RECEIVED" - ResourceRestoring = "RESTORING" - ResourceRunning = "RUNNING" - ResourceStarting = "STARTING" - ResourceStopped = "STOPPED" - ResourceStopping = "STOPPING" - ResourceSucceeded = "SUCCEEDED" - ResourceTerminated = "TERMINATED" - ResourceTerminating = "TERMINATING" - ResourceUp = "UP" + ResourceActive = "ACTIVE" + ResourceAttached = "ATTACHED" + ResourceAttaching = "ATTACHING" + ResourceAvailable = "AVAILABLE" + ResourceCreated = "CREATED" + ResourceCreating = "CREATING" + ResourceCreatingImage = "CREATING_IMAGE" + ResourceDeleting = "DELETING" + ResourceDeleted = "DELETED" + ResourceDetached = "DETACHED" + ResourceDetaching = "DETACHING" + ResourceDisabled = "DISABLED" + ResourceDown = "DOWN" + ResourceDownForMaintenance = "DOWN_FOR_MAINTENANCE" + ResourceFailed = "FAILED" + ResourceFaulty = "FAULTY" + ResourceGettingHistory = "GETTING-HISTORY" + ResourceInactive = "INACTIVE" + ResourceProvisioning = "PROVISIONING" + ResourceRequested = "REQUESTED" + ResourceRequestReceived = "REQUEST_RECEIVED" + ResourceRestoring = "RESTORING" + ResourceRunning = "RUNNING" + ResourceStarting = "STARTING" + ResourceStopped = "STOPPED" + ResourceStopping = "STOPPING" + ResourceSucceeded = "SUCCEEDED" + ResourceTerminated = "TERMINATED" + ResourceTerminating = "TERMINATING" + ResourceUp = "UP" + ResourceWaitingForWorkRequest = "WAITING_FOR_WORK_REQUEST" + ResourceSucceededWorkRequest = "SUCCEEDED_WORK_REQUEST" + + WorkRequestAccepted = "ACCEPTED" + WorkRequestInProgress = "IN_PROGRESS" + WorkRequestFailed = "FAILED" + WorkRequestSucceeded = "SUCCEEDED" // Error codes UserAlreadyExists = "UserAlreadyExists" @@ -78,6 +85,7 @@ const ( headerETag = "ETag" headerLastModified = "last-modified" headerOPCClientRequestID = "opc-client-request-id" + headerOPCWorkRequestID = "opc-work-request-id" headerOPCNextPage = "opc-next-page" headerOPCRequestID = "opc-request-id" @@ -147,6 +155,19 @@ const ( resourceVolumeAttachments resourceName = "volumeAttachments" resourceVolumeBackups resourceName = "volumeBackups" + // LoadBalancer Resources + resourceLoadBalancers resourceName = "loadBalancers" + resourceBackends resourceName = "backends" + resourceBackendSets resourceName = "backendSets" + resourceCertificates resourceName = "certificates" + resourceHealthChecker resourceName = "healthChecker" + resourceListeners resourceName = "listeners" + resourceLoadBalancerPolicies resourceName = "loadBalancerPolicies" + resourceLoadBalancerProtocols resourceName = "loadBalancerProtocols" + resourceLoadBalancerShapes resourceName = "loadBalancerShapes" + resourceLoadBalancerWorkRequests resourceName = "loadBalancerWorkRequests" + resourceWorkRequests resourceName = "workRequests" + apiKeys = "apiKeys" uiPassword = "uiPassword" deviceConfig = "deviceConfig" diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/core_security_list.go b/vendor/github.com/MustWin/baremetal-sdk-go/core_security_list.go index 0914b8791ae..5dd6a70fe68 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/core_security_list.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/core_security_list.go @@ -43,6 +43,7 @@ type IngressSecurityRule struct { Source string `header:"-" json:"source" url:"-"` TCPOptions *TCPOptions `header:"-" json:"tcpOptions,omitempty" url:"-"` UDPOptions *UDPOptions `header:"-" json:"udpOptions,omitempty" url:"-"` + IsStateless bool `header:"-" json:"isStateless" url:"-"` } // EgressSecurityRule is a rule for allowing outbound IP packets. diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backend.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backend.go new file mode 100644 index 00000000000..e1aa094372a --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backend.go @@ -0,0 +1,180 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +import ( + "net/http" +) + +// Backend defines a backend server that is a member of a load balancer backend set. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Backend/ +// Also https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/requests/BackendDetails +type Backend struct { + OPCRequestIDUnmarshaller + OPCWorkRequestIDUnmarshaller + Backup bool `json:"backup"` + Drain bool `json:"drain"` + IPAddress string `json:"ipAddress"` + Name string `json:"name"` + Offline bool `json:"offline"` + Port int `json:"port"` + Weight int `json:"weight"` +} + +// ListBackends contains a list of backends +// +type ListBackends struct { + OPCRequestIDUnmarshaller + Backends []Backend +} + +func (l *ListBackends) GetList() interface{} { + return &l.Backends +} + +// CreateBackend Adds a backend server to a backend set. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Backend/CreateBackend +func (c *Client) CreateBackend( + loadBalancerID string, + backendSetName string, + ipAddr string, + port int, + opts *CreateLoadBalancerBackendOptions, +) (workRequestID string, e error) { + + required := struct { + IPAddr string `header:"-" json:"ipAddress" url:"-"` + Port int `header:"-" json:"port" url:"-"` + }{ + IPAddr: ipAddr, + Port: port, + } + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, resourceBackendSets, backendSetName}, + optional: opts, + required: required, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodPost, details); e != nil { + return + } + + backend := &Backend{} + e = resp.unmarshal(backend) + if e == nil { + workRequestID = backend.WorkRequestID + } + return +} + +// GetBackend Gets the specified backend server's configuration information. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Backend/GetBackend +func (c *Client) GetBackend( + loadBalancerID string, + backendSetName string, + backendName string, + opts *ClientRequestOptions, +) (backend *Backend, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName, + resourceBackends, backendName}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + backend = &Backend{} + e = resp.unmarshal(backend) + return +} + +// ListBackend Lists the backend servers for a given load balancer and backend set. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Backend/ListBackends +func (c *Client) ListBackends( + loadBalancerID string, + backendSetName string, +) (backends *ListBackends, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName, resourceBackends}, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + backends = &ListBackends{} + e = resp.unmarshal(backends) + return +} + +// UpdateBackend Updates the configuration of a backend server within the specified backend set. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Backend/UpdateBackend +func (c *Client) UpdateBackend( + loadBalancerID string, + backendSetName string, + backendName string, + opts *CreateLoadBalancerBackendOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName, + resourceBackends, backendName}, + optional: opts, + } + + var resp *response + if resp, e = c.objectStorageApi.request(http.MethodPut, details); e != nil { + return + } + + backend := &Backend{} + e = resp.unmarshal(backend) + if e == nil { + workRequestID = backend.WorkRequestID + } + return +} + +// DeleteBackend Removes a backend server from a given load balancer and backend set. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Backend/DeleteBackend +func (c *Client) DeleteBackend( + loadBalancerID string, + backendSetName string, + backendName string, + opts *ClientRequestOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName, + resourceBackends, backendName}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodDelete, details); e != nil { + return + } + + backend := &Backend{} + e = resp.unmarshal(backend) + if e == nil { + workRequestID = backend.WorkRequestID + } + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backendset.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backendset.go new file mode 100644 index 00000000000..edbbd6acf49 --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_backendset.go @@ -0,0 +1,182 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +import ( + "net/http" +) + +// BackendSet defines the configuration of a load balancer backend set. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/ +type BackendSet struct { + OPCRequestIDUnmarshaller + OPCWorkRequestIDUnmarshaller + Backends []Backend `json:"backends"` + HealthChecker HealthChecker `json:"healthChecker"` + Name string `json:"name,omitempty"` // Only on create + Policy string `json:"policy"` + SSLConfig SSLConfiguration `json:"sslConfiguration"` +} + +type SSLConfiguration struct { + CertificateName string `json:"certificateName"` + VerifyDepth int `json:"verifyDepth"` + VerifyPeerCertificate bool `json:"verifyPeerCertificate"` +} + +// ListBackendSets contains a list of backend Sets +// +type ListBackendSets struct { + OPCRequestIDUnmarshaller + BackendSets []BackendSet +} + +func (l *ListBackendSets) GetList() interface{} { + return &l.BackendSets +} + +// CreateBackendSet Adds a backend set to a load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/CreateBackendSet +func (c *Client) CreateBackendSet( + loadBalancerID string, + name string, + policy string, + backends []Backend, + healthChecker HealthChecker, + sslConfig SSLConfiguration, + opts *LoadBalancerOptions, +) (workRequestID string, e error) { + + required := BackendSet{ + Name: name, + Policy: policy, + SSLConfig: sslConfig, + HealthChecker: healthChecker, + Backends: backends, + } + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, resourceBackendSets}, + optional: opts, + required: required, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodPost, details); e != nil { + return + } + + backendset := &BackendSet{} + e = resp.unmarshal(backendset) + if e == nil { + workRequestID = backendset.WorkRequestID + } + return +} + +// GetBackendSet Gets the specified backend set's configuration information. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/GetBackendSet +func (c *Client) GetBackendSet( + loadBalancerID string, + backendSetName string, + opts *ClientRequestOptions, +) (backendset *BackendSet, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + backendset = &BackendSet{} + e = resp.unmarshal(backendset) + return +} + +// ListBackendSets Lists all backend sets associated with a given load balancer. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/ListBackendSets +func (c *Client) ListBackendSets( + loadBalancerID string, + opts *ClientRequestOptions, +) (backends *ListBackendSets, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets}, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + backends = &ListBackendSets{} + e = resp.unmarshal(backends) + return +} + +// TODO: Determine if any parameters to the load balancer API are optional. + +// UpdateBackendSet Updates a backend set. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/UpdateBackendSet +func (c *Client) UpdateBackendSet( + loadBalancerID string, + backendSetName string, + opts *UpdateLoadBalancerBackendSetOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName}, + optional: opts, + } + + var resp *response + if resp, e = c.objectStorageApi.request(http.MethodPut, details); e != nil { + return + } + + backendset := &BackendSet{} + e = resp.unmarshal(backendset) + if e == nil { + workRequestID = backendset.WorkRequestID + } + return +} + +// Deletes the specified backend set. Note that deleting a backend set removes its backend servers from the load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/DeleteBackendSet +func (c *Client) DeleteBackendSet( + loadBalancerID string, + backendSetName string, + opts *ClientRequestOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodDelete, details); e != nil { + return + } + + backendset := &BackendSet{} + e = resp.unmarshal(backendset) + + if e == nil { + workRequestID = backendset.WorkRequestID + } + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_certificate.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_certificate.go new file mode 100644 index 00000000000..fe7dc9c2adb --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_certificate.go @@ -0,0 +1,123 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +import ( + "net/http" +) + +// Certificate defines a listener certificate bundle. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Certificate/ +// Also https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/requests/CertificateDetails +type Certificate struct { + OPCRequestIDUnmarshaller + OPCWorkRequestIDUnmarshaller + CACertificate string `header:"-" url:"-" json:"caCertificate"` + CertificateName string `header:"-" url:"-" json:"certificateName"` + PublicCertificate string `header:"-" url:"-" json:"publicCertificate"` + Passphrase string `header:"-" url:"-" json:"passphrase,omitempty"` // Only for create + PrivateKey string `header:"-" url:"-" json:"privateKey,omitempty"` // Only for create +} + +// ListCertificates contains a list of certificates +// +type ListCertificates struct { + OPCRequestIDUnmarshaller + Certificates []Certificate +} + +func (l *ListCertificates) GetList() interface{} { + return &l.Certificates +} + +// CreateBackendSet Adds a backend set to a load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/CreateBackendSet +func (c *Client) CreateCertificate( + loadBalancerID string, + certificateName string, + caCertificate string, + privateKey string, + passphrase string, + publicCertificate string, + opts *LoadBalancerOptions, +) (workRequestID string, e error) { + + required := Certificate{ + CACertificate: caCertificate, + CertificateName: certificateName, + PublicCertificate: publicCertificate, + Passphrase: passphrase, + PrivateKey: privateKey, + } + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, resourceCertificates}, + optional: opts, + required: required, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodPost, details); e != nil { + return + } + + cert := &Certificate{} + e = resp.unmarshal(cert) + if e == nil { + workRequestID = cert.WorkRequestID + } + return +} + +// ListCertificates Lists all SSL certificates associated with a given load balancer. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Certificate/ListCertificates +func (c *Client) ListCertificates( + loadBalancerID string, + opts *ClientRequestOptions, +) (certs *ListCertificates, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceCertificates}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + certs = &ListCertificates{} + e = resp.unmarshal(certs) + return +} + +// Deletes the specified backend set. Note that deleting a backend set removes its backend servers from the load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/DeleteBackendSet +func (c *Client) DeleteCertificate( + loadBalancerID string, + certificateName string, + opts *ClientRequestOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceCertificates, certificateName}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodDelete, details); e != nil { + return + } + + cert := &Certificate{} + e = resp.unmarshal(cert) + if e == nil { + workRequestID = cert.WorkRequestID + } + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_healthchecker.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_healthchecker.go new file mode 100644 index 00000000000..56d0c27e460 --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_healthchecker.go @@ -0,0 +1,78 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +import ( + "net/http" +) + +// The health check policy configuration. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/HealthChecker/ +// Also https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/requests/HealthCheckerDetails +type HealthChecker struct { + OPCRequestIDUnmarshaller + OPCWorkRequestIDUnmarshaller + IntervalInMS int `url:"-" header:"-" json:"intervalInMillis,omitempty"` + Port int `url:"-" header:"-" json:"port,omitempty"` + Protocol string `url:"-" header:"-" json:"protocol,omitempty"` + ResponseBodyRegex string `url:"-" header:"-" json:"responseBodyRegex,omitempty"` + Retries int `url:"-" header:"-" json:"retries,omitempty"` + ReturnCode int `url:"-" header:"-" json:"returnCode,omitempty"` + TimeoutInMS int `url:"-" header:"-" json:"timeoutInMillis,omitempty"` + URLPath string `url:"-" header:"-" json:"urlPath,omitempty"` +} + +// GetHealthChecker Gets the health check policy information for a given load balancer and backend set. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/HealthChecker/GetHealthChecker +func (c *Client) GetHealthChecker( + loadBalancerID string, + backendSetName string, + opts *ClientRequestOptions, +) (healthChecker *HealthChecker, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName, resourceHealthChecker}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + healthChecker = &HealthChecker{} + e = resp.unmarshal(healthChecker) + return +} + +// UpdateHealthChecker Updates the health check policy for a given load balancer and backend set. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/HealthChecker/UpdateHealthChecker +func (c *Client) UpdateHealthChecker( + loadBalancerID string, + backendSetName string, + healthCheckerOptions HealthChecker, // TODO: confirm that all fields are optional + opts *LoadBalancerOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceBackendSets, backendSetName}, + required: healthCheckerOptions, + optional: opts, + } + + var resp *response + if resp, e = c.objectStorageApi.request(http.MethodPut, details); e != nil { + return + } + + healthChecker := &HealthChecker{} + e = resp.unmarshal(healthChecker) + if e == nil { + workRequestID = healthChecker.WorkRequestID + } + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_listener.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_listener.go new file mode 100644 index 00000000000..31819d03506 --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_listener.go @@ -0,0 +1,118 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +import ( + "net/http" +) + +// Listener defines a listener's configuration details. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/requests/ListenerDetails +type Listener struct { + OPCRequestIDUnmarshaller + OPCWorkRequestIDUnmarshaller + DefaultBackendSetName string `json:"defaultBackendSetName"` + Name string `json:"name,omitempty"` // Only for create + Port int `json:"port"` + Protocol string `json:"protocol"` + SSLConfig SSLConfiguration `json:"sslConfiguration"` +} + +// CreateListener Adds a listener to a load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Listener/CreateListener +func (c *Client) CreateListener( + loadBalancerID string, + name string, + defaultBackendSetName string, + protocol string, + port int, + sslConfig SSLConfiguration, + opts *LoadBalancerOptions, +) (workRequestID string, e error) { + + required := Listener{ + Name: name, + DefaultBackendSetName: defaultBackendSetName, + Protocol: protocol, + Port: port, + SSLConfig: sslConfig, + } + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, resourceListeners}, + optional: opts, + required: required, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodPost, details); e != nil { + return + } + + listener := &Listener{} + e = resp.unmarshal(listener) + if e == nil { + workRequestID = listener.WorkRequestID + } + return +} + +// TODO: Determine if any parameters to the load balancer API are optional. + +// UpdateListener Updates a listener for a given load balancer. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Listener/UpdateListener +func (c *Client) UpdateListener( + loadBalancerID string, + listenerName string, + opts *UpdateLoadBalancerListenerOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceListeners, listenerName}, + optional: opts, + } + + var resp *response + if resp, e = c.objectStorageApi.request(http.MethodPut, details); e != nil { + return + } + + listener := &Listener{} + e = resp.unmarshal(listener) + if e == nil { + workRequestID = listener.WorkRequestID + } + return +} + +// Deletes a listener from a load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/Listener/DeleteListener +func (c *Client) DeleteListener( + loadBalancerID string, + listenerName string, + opts *ClientRequestOptions, +) (workRequestID string, e error) { + + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceListeners, listenerName}, + optional: opts, + } + + var resp *response + if resp, e = c.objectStorageApi.request(http.MethodDelete, details); e != nil { + return + } + + listener := &Listener{} + e = resp.unmarshal(listener) + if e == nil { + workRequestID = listener.WorkRequestID + } + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_loadbalancer.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_loadbalancer.go new file mode 100644 index 00000000000..1a9db98848a --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_loadbalancer.go @@ -0,0 +1,171 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +import ( + "net/http" +) + +// LoadBalancer defines a Load Balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancer/ +type LoadBalancer struct { + OPCRequestIDUnmarshaller + OPCWorkRequestIDUnmarshaller + BackendSets []BackendSet `json:"backendSets"` + Certificates Certificate `json:"certificates"` // TODO: confirm this is not an array + CompartmentID string `json:"compartmentId"` + DisplayName string `json:"displayName"` + ID string `json:"id"` + IPAddresses []string `json:"ipAddresses"` + Listeners Listener `json:"listeners"` // TODO: confirm this is not an array + Shape string `json:"shapeName"` + State string `json:"lifecycleState"` + SubnetIDs []string `json:"subnetIds"` + TimeCreated Time `json:"timeCreated"` +} + +// ListLoadBalancers contains a list of load balancers. +type ListLoadBalancers struct { + OPCRequestIDUnmarshaller + NextPageUnmarshaller + LoadBalancers []LoadBalancer +} + +func (l *ListLoadBalancers) GetList() interface{} { + return &l.LoadBalancers +} + +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/requests/CreateLoadBalancerDetails +type CreateLoadBalancerDetails struct { + ocidRequirement + BackendSets *BackendSet `header:"-" json:"backendSets,omitempty" url:"-"` + Certificates *Certificate `header:"-" json:"certificates,omitempty" url:"-"` + Listeners *Listener `header:"-" json:"listeners,omitempty" url:"-"` + Shape string `header:"-" json:"shapeName,omitempty" url:"-"` + SubnetIDs []string `header:"-" json:"subnetIds,omitempty" url:"-"` +} + +// CreateLoadBalancer creates a new load balancer in the specified compartment. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancer/CreateLoadBalancer +func (c *Client) CreateLoadBalancer( + backendSets *BackendSet, + certificates *Certificate, + compartmentID string, + listeners *Listener, + shape string, + subnetIDs []string, + opts *CreateOptions) (workRequestID string, e error) { + + required := CreateLoadBalancerDetails{ + BackendSets: backendSets, + Certificates: certificates, + Listeners: listeners, + Shape: shape, + SubnetIDs: subnetIDs, + } + required.CompartmentID = compartmentID + + details := &requestDetails{ + name: resourceLoadBalancers, + optional: opts, + required: required, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodPost, details); e != nil { + return + } + + loadbalancer := &LoadBalancer{} + e = resp.unmarshal(loadbalancer) + if e == nil { + workRequestID = loadbalancer.WorkRequestID + } + return +} + +// GetLoadBalancer gets the specified load balancer's configuration information. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancer/GetLoadBalancer +func (c *Client) GetLoadBalancer(id string, opts *ClientRequestOptions) (loadbalancer *LoadBalancer, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, id}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + loadbalancer = &LoadBalancer{} + e = resp.unmarshal(loadbalancer) + return +} + +// ListLoadBalancers lists all load balancers in the specified compartment. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancer/ListLoadBalancers +func (c *Client) ListLoadBalancers(compartmentID string, opts *ListOptions) (loadbalancers *ListLoadBalancers, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers}, + required: listOCIDRequirement{CompartmentID: compartmentID}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + loadbalancers = &ListLoadBalancers{} + e = resp.unmarshal(loadbalancers) + return +} + +// UpdateLoadBalancer updates a load balancer's configuration. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancer/UpdateLoadBalancer +func (c *Client) UpdateLoadBalancer(id string, opts *UpdateOptions) (workRequestID string, e error) { + // TODO: Determine if any parameters to the load balancer API are optional. + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, id}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodPut, details); e != nil { + return + } + + loadbalancer := &LoadBalancer{} + e = resp.unmarshal(loadbalancer) + if e == nil { + workRequestID = loadbalancer.WorkRequestID + } + return +} + +// DeleteLoadBalancer stops a load balancer and removes it from service. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancer/DeleteLoadBalancer +func (c *Client) DeleteLoadBalancer(id string, opts *ClientRequestOptions) (workRequestID string, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, id}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.request(http.MethodDelete, details); e != nil { + return + } + + loadbalancer := &LoadBalancer{} + e = resp.unmarshal(loadbalancer) + if e == nil { + workRequestID = loadbalancer.WorkRequestID + } + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_policy.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_policy.go new file mode 100644 index 00000000000..4b856dec6b6 --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_policy.go @@ -0,0 +1,50 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +// The properties that define a load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancerPolicies/ + +type LoadBalancerPolicy struct { + Name string `json:"name"` +} + +// ListLoadBalancerPolicies contains a list of backend policies +// +type ListLoadBalancerPolicies struct { + OPCRequestIDUnmarshaller + LoadBalancerPolicies []LoadBalancerPolicy +} + +func (l *ListLoadBalancerPolicies) GetList() interface{} { + return &l.LoadBalancerPolicies +} + +// ListLoadBalancerPolicies Lists the available load balancer policies. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancerPolicy/ListPolicies +func (c *Client) ListLoadBalancerPolicies( + compartmentID string, + opts *ListLoadBalancerPolicyOptions, +) (loadbalancerPolicies *ListLoadBalancerPolicies, e error) { + required := struct { + CompartmentID string `header:"-" json:"-" url:"compartmentId,omitempty"` + }{ + CompartmentID: compartmentID, + } + details := &requestDetails{ + ids: urlParts{resourceLoadBalancerPolicies}, + required: required, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + loadbalancerPolicies = &ListLoadBalancerPolicies{} + e = resp.unmarshal(loadbalancerPolicies) + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_protocol.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_protocol.go new file mode 100644 index 00000000000..d617e522e8f --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_protocol.go @@ -0,0 +1,50 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +// The properties that define a load balancer. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancerProtocols/ + +type LoadBalancerProtocol struct { + Name string `json:"name"` +} + +// ListLoadBalancerProtocols contains a list of protocols +// +type ListLoadBalancerProtocols struct { + OPCRequestIDUnmarshaller + LoadBalancerProtocols []LoadBalancerProtocol +} + +func (l *ListLoadBalancerProtocols) GetList() interface{} { + return &l.LoadBalancerProtocols +} + +// ListLoadBalancerProtocols Lists the available load balancer policies. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancerPolicy/ListProtocols +func (c *Client) ListLoadBalancerProtocols( + compartmentID string, + opts *ListLoadBalancerPolicyOptions, +) (loadbalancerProtocols *ListLoadBalancerProtocols, e error) { + required := struct { + CompartmentID string `header:"-" json:"-" url:"compartmentId,omitempty"` + }{ + CompartmentID: compartmentID, + } + details := &requestDetails{ + ids: urlParts{resourceLoadBalancerProtocols}, + required: required, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + loadbalancerProtocols = &ListLoadBalancerProtocols{} + e = resp.unmarshal(loadbalancerProtocols) + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_shape.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_shape.go new file mode 100644 index 00000000000..007fdbf740e --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_shape.go @@ -0,0 +1,51 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +// TA shape is a template that determines the total pre-provisioned bandwidth (ingress plus egress) for the load balancer. +// Note that the pre-provisioned maximum capacity applies to aggregated connections, not to a single client attempting to use the full bandwidth. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancerShape/ + +type LoadBalancerShape struct { + Name string `json:"name"` +} + +// ListLoadBalancerShapes contains a list of shapes +// +type ListLoadBalancerShapes struct { + OPCRequestIDUnmarshaller + LoadBalancerShapes []LoadBalancerShape +} + +func (l *ListLoadBalancerShapes) GetList() interface{} { + return &l.LoadBalancerShapes +} + +// ListLoadBalancerShapes Lists the valid load balancer shapes. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/LoadBalancerShape/ListShapes +func (c *Client) ListLoadBalancerShapes( + compartmentID string, + opts *ListLoadBalancerPolicyOptions, +) (loadbalancerShapes *ListLoadBalancerShapes, e error) { + required := struct { + CompartmentID string `header:"-" json:"-" url:"compartmentId,omitempty"` + }{ + CompartmentID: compartmentID, + } + details := &requestDetails{ + name: resourceLoadBalancerShapes, + required: required, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + loadbalancerShapes = &ListLoadBalancerShapes{} + e = resp.unmarshal(loadbalancerShapes) + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_workrequest.go b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_workrequest.go new file mode 100644 index 00000000000..debb6a61bf0 --- /dev/null +++ b/vendor/github.com/MustWin/baremetal-sdk-go/loadbalancer_workrequest.go @@ -0,0 +1,89 @@ +// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +package baremetal + +import ( + "time" +) + +// Many of the API requests you use to create and configure load balancing do not take effect +// immediately. In these cases, the request spawns an asynchronous work flow to fulfill the request. +// WorkRequest objects provide visibility for in-progress work flows. +// +// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/WorkRequest/ + +type WorkRequest struct { + OPCRequestIDUnmarshaller + OPCWorkRequestIDUnmarshaller + ID string `json:"id"` + ErrorDetails []WorkRequestError + State string `json:"lifecycleState"` + LoadBalancerID string `json:"loadBalancerId"` + Message string `json:"message"` + TimeAccepted time.Time `json:"timeAccepted"` + TimeFinished time.Time `json:"timeFinished"` + Type string `json:"type"` +} + +type WorkRequestError struct { + ErrorCode string `json:"errorCode"` + Message string `json:"message"` +} + +// ListWorkRequest contains a list of backend Sets +// +type ListWorkRequests struct { + OPCRequestIDUnmarshaller + NextPageUnmarshaller + WorkRequests []WorkRequest +} + +func (l *ListWorkRequests) GetList() interface{} { + return &l.WorkRequests +} + +// GetWorkRequest Gets the details of a work request. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/WorkRequest/GetWorkRequest +func (c *Client) GetWorkRequest( + workRequestID string, + opts *ClientRequestOptions, +) (workRequest *WorkRequest, e error) { + details := &requestDetails{ + name: resourceLoadBalancerWorkRequests, + ids: urlParts{workRequestID}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + workRequest = &WorkRequest{} + e = resp.unmarshal(workRequest) + return +} + +// ListWorkRequests Lists the work requests for a given load balancer. +// +// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/loadbalancer/20170115/BackendSet/ListWorkRequest +func (c *Client) ListWorkRequests( + loadBalancerID string, + opts *ListLoadBalancerPolicyOptions, +) (workRequests *ListWorkRequests, e error) { + details := &requestDetails{ + ids: urlParts{resourceLoadBalancers, loadBalancerID, + resourceWorkRequests}, + optional: opts, + } + + var resp *response + if resp, e = c.loadBalancerApi.getRequest(details); e != nil { + return + } + + workRequests = &ListWorkRequests{} + e = resp.unmarshal(workRequests) + return +} diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go b/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go index f744cec07df..82a78d05a09 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go @@ -67,6 +67,53 @@ type CreateSubnetOptions struct { SecurityListIDs []string `header:"-" json:"securityListIds,omitempty" url:"-"` } +type LoadBalancerOptions struct { + ClientRequestOptions + RetryTokenOptions +} + +type CreateLoadBalancerBackendOptions struct { + LoadBalancerOptions + Backup bool `header:"-" json:"backup,omitempty", url:"-"` + Drain bool `header:"-" json:"drain,omitempty", url:"-"` + Offline bool `header:"-" json:"offline,omitempty", url:"-"` + Weight int `header:"-" json:"weight,omitempty", url:"-"` +} + +type UpdateLoadBalancerBackendSetOptions struct { + LoadBalancerOptions + RetryTokenOptions + Backends []Backend `header:"-" json:"backends,omitempty" url:"-"` + HealthChecker HealthChecker `header:"-" json:"healthChecker,omitempty" url:"-"` + Policy string `header:"-" json:"policy,omitempty" url:"-"` + SSLConfig SSLConfiguration `header:"-" json:"sslConfiguration,omitempty" url:"-"` +} + +type UpdateLoadBalancerListenerOptions struct { + LoadBalancerOptions + DefaultBackendSetName string `header:"-" json:"defaultBackendSetName" url:"-"` + Port int `header:"-" json:"port" url:"-"` + Protocol string `header:"-" json:"protocol" url:"-"` + SSLConfig SSLConfiguration `header:"-" json:"sslConfiguration" url:"-"` +} + +type ListLoadBalancerPolicyOptions struct { + ClientRequestOptions + ListOptions +} + +type ListLoadBalancerOptions struct { + ClientRequestOptions + ListOptions + CompartmentID string `header:"-" json:"-" url:"compartmentId,omitempty"` + Detail string `header:"-" json:"-" url:"detail,omitempty"` +} + +type UpdateLoadBalancerOptions struct { + LoadBalancerOptions + DisplayNameOptions +} + type CreateVolumeOptions struct { CreateOptions SizeInMBs int `header:"-" json:"sizeInMBs,omitempty" url:"-"` diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/requestor.go b/vendor/github.com/MustWin/baremetal-sdk-go/requestor.go index b065d63f210..d40392c231e 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/requestor.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/requestor.go @@ -116,6 +116,10 @@ func (api *apiRequestor) request(method string, reqOpts request) (r *response, e if e = createAuthorizationHeader(req, api.authInfo, api.userAgent, jsonBuffer); e != nil { return } + if e != nil { + log.Printf("[WARN] Could not get HTTP authorization header, error: %#v\n", e) + return + } if os.Getenv("DEBUG") != "" { reqdump, err := httputil.DumpRequestOut(req, true) @@ -128,12 +132,12 @@ func (api *apiRequestor) request(method string, reqOpts request) (r *response, e var resp *http.Response resp, e = api.httpClient.Do(req) + if e != nil { + log.Printf("[WARN] Could not get HTTP Response, error: %#v\n", e) + return + } if os.Getenv("DEBUG") != "" { - if e != nil { - log.Printf("[WARN] Could not dump HTTP Response, error: %#v\n", e) - return - } respdump, err := httputil.DumpResponse(resp, true) if err == nil { log.Printf("[DEBUG] HTTP Response: %v\n", string(respdump)) diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/response.go b/vendor/github.com/MustWin/baremetal-sdk-go/response.go index 746dfec802a..a708a1a1e59 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/response.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/response.go @@ -31,6 +31,8 @@ func (r *response) unmarshal(resource interface{}) (e error) { if e = cs.SetBody(r.body, val); e != nil { return } + } else if len(r.body) == 0 { + // Continue without error. This is usually caused by a 204 response } else if e = json.Unmarshal(r.body, val); e != nil { return } @@ -43,6 +45,10 @@ func (r *response) unmarshal(resource interface{}) (e error) { crr.SetClientRequestID(r.header.Get(headerOPCClientRequestID)) } + if wrr, ok := resource.(OPCWorkRequestIDUnmarshallable); ok { + wrr.SetWorkRequestID(r.header.Get(headerOPCWorkRequestID)) + } + if et, ok := resource.(ETagUnmarshallable); ok { et.SetETag(r.header.Get(headerETag)) } diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/response_unmarshallers.go b/vendor/github.com/MustWin/baremetal-sdk-go/response_unmarshallers.go index aaba94f7128..44ad8edac13 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/response_unmarshallers.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/response_unmarshallers.go @@ -57,6 +57,18 @@ func (r *OPCClientRequestIDUnmarshaller) SetClientRequestID(id string) { r.ClientRequestID = id } +type OPCWorkRequestIDUnmarshallable interface { + SetWorkRequestID(id string) +} + +type OPCWorkRequestIDUnmarshaller struct { + WorkRequestID string +} + +func (r *OPCWorkRequestIDUnmarshaller) SetWorkRequestID(id string) { + r.WorkRequestID = id +} + type LastModifiedUnmarshallable interface { SetLastModified(time.Time) } diff --git a/vendor/vendor.json b/vendor/vendor.json index 8c8d6b47ccb..2a52c440c3b 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -315,10 +315,10 @@ "revisionTime": "2017-02-01T00:43:30Z" }, { - "checksumSHA1": "iQeewNH9r06wDEBjVVUEAksGxlI=", + "checksumSHA1": "poKBZQ8AFlXGB1cUjeIUptVtrmM=", "path": "github.com/MustWin/baremetal-sdk-go", - "revision": "c63f99f400648cda8b9bb93b4a10ac89276307ad", - "revisionTime": "2017-04-07T01:02:09Z" + "revision": "90056d2a697d91f59e355ed698b1150bb23e19b9", + "revisionTime": "2017-04-04T04:32:14Z" }, { "checksumSHA1": "Aqy8/FoAIidY/DeQ5oTYSZ4YFVc=", From df94c42f9a7a3fb43cfd3560db3a8f92b94fefb6 Mon Sep 17 00:00:00 2001 From: Mike Ihbe Date: Mon, 3 Apr 2017 22:11:47 -0700 Subject: [PATCH 11/14] Fix VirtualRouterIP name --- vendor/vendor.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/vendor.json b/vendor/vendor.json index 2a52c440c3b..738dd191488 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -318,7 +318,7 @@ "checksumSHA1": "poKBZQ8AFlXGB1cUjeIUptVtrmM=", "path": "github.com/MustWin/baremetal-sdk-go", "revision": "90056d2a697d91f59e355ed698b1150bb23e19b9", - "revisionTime": "2017-04-04T04:32:14Z" + "revisionTime": "2017-04-04T04:32:14Z", }, { "checksumSHA1": "Aqy8/FoAIidY/DeQ5oTYSZ4YFVc=", From 452fb59e35e60301cd9ed09cd14cb43059084738 Mon Sep 17 00:00:00 2001 From: Mike Ihbe Date: Tue, 11 Apr 2017 10:00:55 -0700 Subject: [PATCH 12/14] Add docs for iscsi volume attachment attributes --- docs/resources/core/volume_attachment.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/resources/core/volume_attachment.md b/docs/resources/core/volume_attachment.md index b794bf4cf98..e33788d7f82 100644 --- a/docs/resources/core/volume_attachment.md +++ b/docs/resources/core/volume_attachment.md @@ -33,5 +33,7 @@ The following arguments are supported: * `state` - The current state of the volume attachment: [ATTACHING, ATTACHED, DETACHING, DETACHED]. * `time_created` - The date and time the volume was created * `volume_id` - The OCID of the volume. - - +* `chap_username` - The volume's system-generated Challenge-Handshake-Authentication-Protocol (CHAP) user name. +* `chap_secret` - The Challenge-Handshake-Authentication-Protocol (CHAP) secret valid for the associated CHAP user name. (Also called the "CHAP password".) +* `ipv4` - The volume's iSCSI IP address. +* `iqn` - The target volume's iSCSI Qualified Name in the format defined by RFC 3720. From 90902d659afdd2f6dd4662d16b408f76b33f023a Mon Sep 17 00:00:00 2001 From: Mike Ihbe Date: Tue, 11 Apr 2017 10:03:16 -0700 Subject: [PATCH 13/14] Fix bad merge, duplicate DNSLabel --- vendor/github.com/MustWin/baremetal-sdk-go/request_options.go | 1 - 1 file changed, 1 deletion(-) diff --git a/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go b/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go index 82a78d05a09..3c778e3418c 100644 --- a/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go +++ b/vendor/github.com/MustWin/baremetal-sdk-go/request_options.go @@ -62,7 +62,6 @@ type CreateSubnetOptions struct { CreateOptions DNSLabel string `header:"-" json:"dnsLabel,omitempty" url:"-"` DHCPOptionsID string `header:"-" json:"dhcpOptionsId,omitempty" url:"-"` - DNSLabel string `header:"-" json:"dnsLabel,omitempty" url:"-"` RouteTableID string `header:"-" json:"routeTableId,omitempty" url:"-"` SecurityListIDs []string `header:"-" json:"securityListIds,omitempty" url:"-"` } From 2457323c05d4ce265058a26eb81cc1226a62b63c Mon Sep 17 00:00:00 2001 From: Mike Ihbe Date: Tue, 11 Apr 2017 10:06:54 -0700 Subject: [PATCH 14/14] Fix another bad merge --- core/subnet_resource.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/core/subnet_resource.go b/core/subnet_resource.go index 3531fb28b8a..d7df69c6089 100644 --- a/core/subnet_resource.go +++ b/core/subnet_resource.go @@ -55,22 +55,13 @@ func SubnetResource() *schema.Resource { Optional: true, Computed: true, }, -<<<<<<< HEAD - "dns_label": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "dhcp_options_id": { - Type: schema.TypeString, -======= + "dhcp_options_id": { Type: schema.TypeString, Optional: true, }, "dns_label": { Type: schema.TypeString, ->>>>>>> 61edbd6db31bd1392a23f52271f2f8057dc74e8f Optional: true, }, "id": {